Get Datatable Ajax URL with all parameters

Get Datatable Ajax URL with all parameters

KhanaKhana Posts: 2Questions: 1Answers: 0

Hi everyone,

Into the Javascript code, I simply can't figure out how to get the whole URL of a Datatable Ajax call, with all the settings in it,

I want to get a string like that :[0][data]=first_name&columns[0][name]=&columns[0][searchable]=true&columns[0][orderable]=true&columns[0][search][value]=&columns[0][search][regex]=false&columns[1][data]=last_name&columns[1][name]=&columns[1][searchable]=true&columns[1][orderable]=true&columns[1][search][value]=&columns[1][search][regex]=false&columns[2][data]=position&columns[2][name]=&columns[2][searchable]=true&columns[2][orderable]=true&columns[2][search][value]=&columns[2][search][regex]=false&columns[3][data]=office&columns[3][name]=&columns[3][searchable]=true&columns[3][orderable]=true&columns[3][search][value]=&columns[3][search][regex]=false&columns[4][data]=start_date&columns[4][name]=&columns[4][searchable]=true&columns[4][orderable]=true&columns[4][search][value]=&columns[4][search][regex]=false&columns[5][data]=salary&columns[5][name]=&columns[5][searchable]=true&columns[5][orderable]=true&columns[5][search][value]=&columns[5][search][regex]=false&order[0][column]=0&order[0][dir]=asc&start=0&length=10&search[value]=k&search[regex]=false&_=1501262539441

Can anyone enlighten me?


  • kthorngrenkthorngren Posts: 6,522Questions: 22Answers: 1,424

    You can use ajax.params() and ajax.url() to get the information. You could then parse the results to build the above string.


  • KhanaKhana Posts: 2Questions: 1Answers: 0

    Why should I parse the ajax.params() while Datatable do it itself to call the Ajax URL? Can't I retrieve this string without bothering to reconstitute it?

    (My goal is to update the browser's history after each Datatable Ajax call)

  • dtuser18dtuser18 Posts: 2Questions: 1Answers: 0

    I agree with Khana. The last ajax full URL could easily be provided by a built-in method (the core does that anyway). Could you please add this functionality?

  • allanallan Posts: 50,571Questions: 1Answers: 7,530 Site admin

    DataTables does't translate the data object, jQuery does that for us, via the $.param() method (at least, that's what I believe jQuery does internally).

    That said, why would you want to get the URL encoded parameters on the client-side? I curious about the use case, since it would be easier to use the API to get those values.


Sign In or Register to comment.