Lucas B Lucas B - 3 months ago 11
Javascript Question

How to print the $_REQUEST that is available inside a specific AJAX function?

I'm a beginner in PHP, and I'm having some trouble debugging AJAX, because I can't just print_r what I want to know inside the script.

I'm using a AJAX image upload plugin that have a lot of functions such as receive post, file check, etc, to finally get to the "insertTodatabase" funcion. I want to know what data is being sent to this final fuction, how can I echo the $_REQUEST of such function, for example?

I'm sorry if my question is vague, I'm doing my best to explain.
Thank you.

Answer

You can use the error_log function to write data to your error log. Then just view your error log and you can have the information stored there.

Example:

error_log('UserName: ' . $username);