I'm trying to create a pagination using jquery. I want to return a ajax success response to global Variable. I have created a global variable and stored the response. But I cannot access outside of success block. I want to change the value dynamically, because it will retrive the data when I click the next page without refresh. Thanks in advance..
Code :
var tmp;
$('table').DataTable ({
serverSide:true,
ajax : {
url:'http://localhost:8000/api/feeds/1/',
type:'GET',
},drawCallback : function(settings) {
var api = this.api();
tmp = api.rows({page:'current'}).data();
}
});
console.log(tmp);