You can use JavaScript console to output global and other variables from your PHP file. That way you can use JS console to track what is is going on in PHP backed files that are called by
$.ajax. Also you should be familiar with PHP's functions
utf8_encode and
utf8_decode
 |
| Raw outuput of JSON string and Base64 encoded JSON string |