I have created a php page that displays some records from my db.
I also have a button that executes some ajax to update the records, and then show the new / updated dataset on the same page.
I'm having problems with my ajax call and I'd like some tips on how to troubleshoot.
I've noticed that since my header has been explicitly set to be json content, i can't just do things like var_dump from the controller to see the data BEFORE it is sent to the view.
Unfortunately, for some reason, my console.log calls in the ajax method are not working for me either. i don't know why.
But I'm wondering if someone can tell me other ways to debug my code. I know I can change the json data type to html / text and then remove all code in my controller that sets headers / calls json_encode... but just in case there's a better way, I thought I'd ask.
You can use the Developer console in Chrome, click on the Network tab, and then at the bottom you can limit the type to "XHR" then you can try to make the AJAX request, and you should see everything there is to see about it, including the response, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With