Double AJAX call appends data to datatables rather than overwrite it.
Double AJAX call appends data to datatables rather than overwrite it.
metateck
Posts: 10Questions: 0Answers: 0
Test Case: http://api-dev.pigeonly-api.com/admin/inmate-search?sex=&first_name=john&last_name=miller
This page makes 2 AJAX requests on load. The first is just with an empty form (this happens upon datatables initialization), and the second happens only if there are GET parameters. It will simply resubmit the form if there are GET parameters. Since this AJAX call happens second, I expect the second AJAX call response to overwrite the first AJAX call response in datatables. Instead, you get appended data.
The AJAX file being called has a hardcoded limit of 500 records in its response. In the test case, you will get around 560 records. If you hit search from the test case with the params, the AJAX will be called a 3rd time and this time will get only the 60 records. If you go to the test case without the GET params, then you will get 500 records.
This page makes 2 AJAX requests on load. The first is just with an empty form (this happens upon datatables initialization), and the second happens only if there are GET parameters. It will simply resubmit the form if there are GET parameters. Since this AJAX call happens second, I expect the second AJAX call response to overwrite the first AJAX call response in datatables. Instead, you get appended data.
The AJAX file being called has a hardcoded limit of 500 records in its response. In the test case, you will get around 560 records. If you hit search from the test case with the params, the AJAX will be called a 3rd time and this time will get only the 60 records. If you go to the test case without the GET params, then you will get 500 records.
This discussion has been closed.
Replies
Allan
Allan