Pointers for debugging Ajax code... |
Site Admin
|
Browser does not execute php and I'm not sure how would debugger return execution to it. Please check your javascript. Probably a kind of timeout triggers there and browser gets execution before the results are provided by the php. |
||||||||||||||
_________________ The PHP IDE team |
|
Yes, I am aware that PHP is not executed in the browser. I meant that it's not returning the results of the script to the browser I'm not getting anything returned. (Note that while not debugging, it seems to be working fine...) |
||||||||||||||||
|
Site Admin
|
If you start debuging your php script via an ajax call, it should return the result to the browser. You may want to add an alert to see the returned data.
again, if script is executed through the ajax call, it will return data the same way regardless you run it with debugger or not. The only difference is time. When you debug your script and execute line by line, it runs much slower so the client may timeout. In this case the added alert will trigger much sooner than you finish your scipt in the debugger. |
||||||||||||||
_________________ The PHP IDE team |
|
The alert was not getting displayed. The problem is... some requests have the problem and some do not (which leads me to believe it's in my code...). I finally narrowed it down. The calls that are failing are post events where I send XML in the Request body. If I comment out the following line: $body = @file_get_contents('php://input'); it returns no problem (Of course, I can't get my data from the request, but it does return...) Have you seen this? (Or am I getting the request data the wrong way?) Thanks. |
||||||||||||||||
|
Site Admin
|
so the browser kept waiting.
I'd say, it's quite a strange way of handling posts. If it is HTTP POST you're sending your XML request with, you may want to read your data in $_POST[] array or $HTTP_RAW_POST_DATA To send the results back to the browser, you need to echo() or print() your data. |
||||||||||||||||
_________________ The PHP IDE team |
|
Well that seems to work. Your expertise is much appreciated! Not that it matters, but why do you say that's a strange way to handle a post? Because I learned that in an AJAX book long ago and I've always done that. Again, thanks! |
||||||||||||||||||
|
Site Admin
|
It's strange for anything other than CGI. Only CGI scripts read their POST in the input. In most cases php is not used as CGI and even in this case it would read the input for you and place the results into the arrays I mentioned before your scripts got executed. |
||||||||||||||
_________________ The PHP IDE team |
|
Understood. Again, thanks! |
||||||||||||||||
|
Pointers for debugging Ajax code... |
|
||
Content © NuSphere Corp., PHP IDE team
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by