How can I find the source of rogue Ajax requests in IE?

I rewrote my family website using Javascript (JQuery) making php ajax calls in the back. This is your standard "thumbnail pile" and one main image, and when you click on the thumbnail, the main image changes to "look". Everything works as expected when using Firefox, but in IE, when I click on the thumbnail, the main image changes to the one I clicked on and then immediately returns to the first one. I've tried the MS Script debugger to no avail; I have set a breakpoint in the javascript code that triggers the ajax call and when I click the thumbnail the breakpoint is triggered. Then I hit F5 and it continues but doesn't fire again. If I use Wireshark to view actual TCP packets over the network, I see,that we are definitely sending more than one request to the server. I can't figure out where the second request comes from (the one that goes back to the original image).

Any suggestions? One example of what I am talking about is here .

+1


source to share


3 answers


Debugging through your site looks like this here:

After the first image is cropped, the event is resized, so this code is called:

$ (window) .bind ("resize", function () {ResizeWindow ('nicholas-1');}) ;;});

which, as you know, reloads your gallery. Now I can't tell why this is happening, but this is where the problem begins.



In the future, to debug this, I used VS2008 to attach to IE. Then I put the break in $ ajax () at:

    // Send the data
    try {
        xhr.send(s.data);
    } catch(e) {
        jQuery.handleError(s, xhr, null, e);
    }

      

Then I just press F5 which fires for the first two ajax calls, then I open the call stack window when I found the ajax rogue call and walked the call stack back to the function that was inserted earlier.

Good luck.

+3


source


You can use Fiddler , a free proxy server for debugging Internet Explorer. This has been a big help for me many times when I have to debug specific server-related issues in IE.

Here is an Introduction to Fiddler on MSDN .



alt text http://i.msdn.microsoft.com/Bb250446.ie_introfiddler_fig04(en-us,VS.85).gif

+1


source


IE is part of the job, isn't it? Have you tried something like this?

var inProcess = 0;

function eventHandler () {

if (inProcess == 0) {

  inProcess = 1;

  // do stuff

  setTimeout('inProcess = 0', 5000);

}

      

}

Nice guy, by the way.

0


source







All Articles