1
That’s because selected
variable is parsed as a Django template variable, but actually it’s not. It’s a JS variable and, thus, it’s parsed as an empty string.
There is a workaround, though:
jQuery(document).ready(function($) {
$("#continue").click(function() {
var selected = $("#meds").bootgrid("getSelectedRows");
var url = "{% url 'meds:prescription' 'test' %}"; // 'test' is just a placeholder value
url = url.replace('test', selected); // replace 'test' with the 'selected' value
window.location = url;
});
});
Source:stackexchange.com