jQuery AJAX callback not executed when debugging via Firebug -


It is often observed behavior that jQuery's asynchronous AJAX call works while running without opening firebug, however, when it works Firebug is opened and I'm debugging by putting some breakpoints in some part of the code, the AJAX callback event does not fire.

My assumption is this, because I already get the AJAX feedback callback event escaping in the second unrelated part of the step-step, whether this assumption is correct is? If so, how do I make sure that the callback always fire? If not, what am I doing?

My assumption is this, because I'm already in the second unrelated part of the code Ajax response callback event is saved while debugging the two-stage debugging. Is this belief correct?

Yes, in firebug 1.x Although he is in firebug 2.0 (while writing this answer in beta phase).

Example See the following code:

  & lt; script type = "text / javascript" & gt; Function Mercantile () {var xhr = new XMLHttpRequest (); Xhr.open ("GET", "test.php"); Xhr.onreadystatechange = function () {if (xhr.readyState === XMLHttpRequest.DONE) console.log ("Request Ended"); } Xhr.send (null); Debugger; } & Lt; / Script & gt; & Lt; Button onclick = "makeRequest ()" & gt; Request & lt; / Button & gt;   

When you click the Request button to log in to the console, you will click on Expiration on firebug In 1.12.8, the output is not displayed in the console, while it is in 2.0. The reason for this is that Firebug 2.0 revealed in front of Firefox, which cured this problem.

However note that the asynchronous call will not be postponed to onreadystatechange . This means that it will be executed whenever you exit the debugger keyword, so a breakpoint on console.log ("Request Ended") Not .

This is a difference between Chrome's JavaScript engine, Opera and Internet Explorer, where the execution of the asynchronous function is waiting for the debugger to continue execution of the script.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -