how can i remove the auto-attached parameter "_" when getting data using server-side proccessing
how can i remove the auto-attached parameter "_" when getting data using server-side proccessing
Hi,
I am using sAjaxSource to get data from server side, and am using fnServerParams to customize my parameters, which the code looks like this:
var dd = $('#form-table').DataTable({
"destroy": true,
'sAjaxSource': "/form/load_fields/",
'fnServerParams': function ( aoData ) {
aoData.push( { "name": "id", "value": "{{$form->id}}" } );
},
});
i need to match the router rules for some reason, actually, the sAjaxSource points to an MVC controller action, which, need and only need one parameter, 'id'. However, when the ajax event triggers, i can see there is always a parameter "" at the end of the ajax url, something like "http://localhost/form/load_fields/?id=29&_=1402540233777", i dont want that ""parameter, but i can't find how to remove it out
anyone can help?
This question has an accepted answers - jump to answer
Answers
It is the jQuery anti-cache parameter. Add
cache: true
to yourajax
object to remove it.Allan
ah, it's working. thank you allan. BTW, is there a way to change the ajax url into clean format like "http://localhost/form/load_fields/29"? i've search the documentation but couldnot find one.
You would just specify the URL to load as that which you want. DataTables (nor jQuery) will convert your URL from one form to another.
Allan
yeah, that's it, thank you Allan and the great plugin