How to save the current page of a datatable to a variable?

Asked

Viewed 160 times

0

I would like to save in the variable page the value of the current page of a table using the Datatable plugin, by their documentation I believe it is more or less like this, but it is not working.

var table = $('#myTable').DataTable();
var pagina = table.page();
  • It gives some error ? what happens ? what presents console.log(pagina); ?

  • appears Undefined

  • And console.log(table); gives what? There is an element with id myTable ? Jquery was included ? the datatables plugin was also included?

  • console.log(table); gives [Object objetc], my datatable ta working perfectly, I would just like to be able to save the page number in a php variable.

  • To do this you must use ajax. Save to a variable only if it is in javascript variable.

  • i am trying to write in a javascript variable, but it’s not rolling.

  • have you tried making var pagina = table.page.info().page+1; ? Example of datatables documentation

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.