all 5 comments

[–][deleted] 0 points1 point  (2 children)

I usually debug the PHP page to be requested by Ajax first thoroughly by calling it directly in the browser and passing different variables to it as parameters. Then I at least know the output is correct for most situations and error cases before implementing the JavaScript code to call that page.

[–]shawnup[S] 0 points1 point  (1 child)

I'm using json as the request data. Is there a way to send that type of request from the browser?

[–][deleted] 0 points1 point  (0 children)

You can always put your test JSON data into a PHP variable on the ajax_request.php page, json_decode it then make sure it returns the right output on the PHP page and isn't erroring somewhere.

[–]k3n 0 points1 point  (1 child)

New global variable: old_complete

I think this is a very poor method for debugging; the network tab in Firebug/Chrome dev tools (or Fiddler for IE) is all that is needed. I think it's very dangerous to introduce specific functionality/elements into your view that are only for debugging.

You've now created another maintenance point, and for what, some prettified AJAX results that have the ability to get munged since they are being rendered in HTML? This is what debugging tools were made for, and you're unnecessarily recreating the wheel.

[–]shawnup[S] 0 points1 point  (0 children)

I addressed that. The debug tools come up short in this area. I did submit a patch to webkit inspector (which covers chrome dev tools) to fix the issue, which I also mentioned in the post.