6

I'm testing an Ajax/jQuery-loaded PHP module and I was wondering if there's a simple way to debug this without using a full featured debugger.

My very simple debugging option is to echo some data and read browser output, however due to Ajax-loaded modules nature, output is hidden.

While I can return debugging data until the ajax-loaded module is running, I can't track or "see" program interruptions if error occurs.

Is there a way to allow "output" also in the ajax-loaded modules? Or ?

4 Answers 4

3

I suppose a solution could be using FirePHP :

  • On the PHP side, you generate some specific HTTP-headers -- which will not be part of the output itself -- using its PHP library.
  • And, in Firefox, you install the FirePHP extension, which will parse those headers, and display the corresponding data in Firebug.
Sign up to request clarification or add additional context in comments.

2 Comments

This is a very neat way of solving this problem as it keeps the JS/Ajax logs right beside the PHP log. I have had it built into our apps for debugging for some time now and it really saves a lot of work. +1
The PHP library link is broken
2

Use WebKit's console (Chrome / Safari) or FireBug to check what's going on and make use of console.log() in both. Google a bit to see what console is and how console.log() is useful for debugging in such apps. In webkit you can also have breakpoints and other nice fiddly things that usually only IDE's offer.

1 Comment

Michael, I'm already using Firebug....however the debugging session should occur in the PHP realm.... console.log() seems to be used in the Javascript side
1

Grab the 'HTTPFox' add on for Firefox, you'll wonder how you managed to do anything (especially with AJAX) without it.

https://addons.mozilla.org/en-US/firefox/addon/httpfox/

Comments

1

It is also possible to inspect requests and responses on a browser agnostic basis with Fiddler so debugging Ajax can be done on any browser, even old versions of Internet Explorer.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.