NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
XMLHttp debugging problem


Joined: 08 Mar 2006
Posts: 7
Reply with quote
I am attempting to debug a php program being invoked via XMLHttp. I can't seem to do it.

It is a pretty simple situation. I have a page containing a button that runs a javascript function that uses XMLHttp to post a request to the server. Clicking the button does successfully launch the request, but I am unable to catch it in the debugger.

What should I do? Thanks.
View user's profileFind all posts by Kevin ComerSend private message


Joined: 09 Dec 2003
Posts: 92
Reply with quote
Debugging XMLHTTP (aka AJAX) requests is no problem at all... If you have the DBGSESSID cookie set on the page that triggers the request, it should be automatically sent with the AJAX request and activate the debugger.

One solution that always works when everything else fails Smile is to place the debugBreak() command in the php script that XMLHTTP is calling.
View user's profileFind all posts by mpSend private message
hanging now


Joined: 08 Mar 2006
Posts: 7
Reply with quote
Okay, I renamed my test.html file to test.php and ran using F9. Debugger halts processing on line 6 which happens to be the fist <script> tag. There is no php in file. I press F9 to resume processing and the page containing the button is displayed under PhpEd output tab.

I have a breakpoint set on the first line of the php file being invoked via XMLHttp. When I click the button, PhpEd hangs. Button image remains "depressed".

I am debugging in local Apache server configured as a 3rd party Web server in PhpEd.
View user's profileFind all posts by Kevin ComerSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
Certainly, a pure HTML/Jscript file has no php but being processed by php, it is converted to series of echos and that's why debugger allows to step through it.

You may want to add DBGSESSID to the URL you call with XMLHttp, or put DebugBreak in the code called by this URL.
For example with DBGSESSID your URL might look like this:

http://localhost/adirectory/ascript.php?DBGSESSID=1

or your code might look like this:
<?php
DebugBreak();
// the rest of the script is below
...
?>
View user's profileFind all posts by dmitriSend private messageVisit poster's website
XMLHttp debugging problem
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic