Debug whats going on inside a function called from AJAX

You aren’t echoing anything so you aren’t going to get much of an AJAX response. All you are doing with AJAX, really, is loading a webpage with Javascript. If the page doesn’t print anything, you don’t see anything. You don’t need to return anything from AJAX but if you don’t you will have a hard time working out whether your action was successful.

If you need to get information back, even for debugging, just echo it, or var_dump it. You will be able to see your echoed or var_dumped content with FireBug. Be aware that if your AJAX content is supposed to be something like JSON this debugging hack will break it.

Also, it kinda looks like you expect an ID to come back from your AJAX call. You will need to echo that in the delete_pdf_and_metadata function, or build a JSON object and echo that.

Leave a Comment