Alex Rivera | Logout

IE not triggering jQuery Ajax success

Asked 2009-04-23T16:32:59.530
15

I'm working on a script to load some images async using jQuery.

Here is a code snippet of the function that loads the images -

try{
    for(img in imgsArray){
        $.ajax({    
            async: false,
            type: "get",
            url:imgsArray[img],
            success:function(imgFile){
                alert("success");
                //do something useful
            },
            error:function(XMLHttpRequest,status,error){
                //do nothing
            }
        });//ajax
    } 
}
catch(e){
    //oops
}

I have tested this in Firefox, Webkit (Safari,Chrome) and it works.

The images are in a folder on the server and I'm using jQuery 1.3.

any ideas?

Edit
Report

2 Answers

1

I've been having similar problems with IE and AJAX over the past few days with my JSONP Web Service. Even the smallest error in your code can cause everything to break in IE.

Probably the best thing to do is debug the page in IE using Visual Web Developer Express or Visual Studio. Here is a tutorial of how to do it:

How to debug JavaScript with Visual Web Developer Express

Follow the instructions and maybe place breakpoints on at the begining of the AJAX request.

Try these things too:

  • Removing "XMLHttpRequest" from the error field, I have never used it before and my code works just fine;
  • Make sure you are using the latest version of jquery (1.3.2)?

Hope you get it working soon!

answered 2009-04-24T02:24:16.800
0

I'd suggest using Charles Proxy to see what's going on - i.e. is the request going out at all? What's the response?

Also, I think there might be some Exception thrown, so why don't you add some alerts in the Catch section to see what happens?

answered 2009-04-23T16:54:43.110

Your Answer