Problem with Ajax into DataTables
Problem with Ajax into DataTables
inomi
Posts: 6Questions: 0Answers: 0
I uses DataTables 1.10.21 but I have problem because into table I have small Ajax and when page load everything is works but when I click pagination or input search my Ajax now it stop. Can you find solution my problem ?
Replies
Can you please provide some reproducible code
'
I'm not seeing any DataTables code in there - and it's working fine here. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
I include jquery.dataTables.js to my index.php and below code. My Table has id ="Table_name" and everythink works but into table i have small ajax and this ajax is work. when i click pagination or change dataTables_length now my ajax is stop.
I think problem is ajax in DataTables because when i set dataTables_length =100 my ajax works only for 100 rows.
Sounds like you are fetching data via Ajax then directly accessing the DOM to update the table instead of using Datatables API's. If this is correct then see this FAQ. If this doesn't help then, as Colin asked please post a link to your page or a test case replicating the issue so we can see what your code is doing.
Kevin
I think where is my problem because when i have 100 rows in my Table and I set dataTables_length =10. Page load only 10 rows. When i click search, change length or click pagination the code will import new data but my ajax will be work only for 10 rows when page loaded.
What is
dataTables_length
?Without seeing what you are doing we won't be able to help debug. You small code snippets are not enough to understand what the code is doing. Please post a link to a test case so we can see you code flow and ajax responses.
Kevin
dataTables_length is lengthMenu
I work on localhost so i don't give you link
Have you looked at the browser's console for errors?
What is the JSON response when the issue occurs? Use the browser's network. inspector to see the response.
If you can't show us a test case then please post your full JS code and the JSON response from the network inspector when the problem occurs.
Kevin