We provide detailed description of the debugging techniques using the example of these
two scripts in our article:
Debugging PHP, JSON and JavaScripts Application.
In that example we used NuSphere’s PhpED and dbg – PHP debugger to present the advantages of good PHP Editor/IDE.
Following the instructions there you can step through
JavaScript in FireFox and step through PHP Code in
PhpED .
You will see how when the following code segment is executed,
GET request is being sent to PHP script, which you can debug using good PHP IDE and debugger:
var script = document.createElement("script"); script.setAttribute("id", "dynamic_script_injection_node"); script.setAttribute("type", "text/javascript"); script.setAttribute("src", request); // all set, add the script head.appendChild(script);
Dynamic script injection doesn't suffer from the traditional limitations of XMLHttpRequest,
such as prohibition of cross-domain scripting.
For example, JavaScript on any of your partner's or customer's web site
can use Dynamic script injection to send the request to PHP scripts on your site
and your PHP can reply in JSON, providing dynamic content to multiple sites on different domains.
Go To Part 3 of PHP, JSON and JavaScript in Web2.0 Applications
Go To Part 1 of PHP, JSON and JavaScript in Web2.0 Applications
|