I want to inject a variable into url like in the code. But It gives an error.
function initializeDataTable(id){
var columnSize = $('table th').size();
$('#table').dataTable({
"sDom" : 'rtFip>',
'fnDrawCallback' : function() {
$('input:checkbox, input:radio').checkbox();
},
"bStateSave": true,
'sPaginationType' : 'full_numbers',
"bServerSide" : true,
"sAjaxSource" : "{% url 'get_menu_list' '" + id + "' %}"
});
};
I want to get the selected option and in the option change event, I will call the function above. How can I do that?
You can’t do this:
{% %}are server-side directives. The server processes them and then puts them in the response page. The javascript function runs client-side. It can’t talk to the server and ask it for data in the way you have expected it to do here. You will have to do something that doesn’t depend on the server, such as: