IE not triggering jQuery Ajax success

后端 未结 13 1095
心在旅途
心在旅途 2020-12-06 10:50

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 i         


        
相关标签:
13条回答
  • 2020-12-06 10:59

    use the following tag to support cross browser

    $.support.cors = true;

    0 讨论(0)
  • 2020-12-06 10:59

    Maybe there is a problem with encoding. try this

    $.ajax({
            type: 'GET',
            url: encodeURI(url ),
            dataType: 'text',
            success: function (data) {
                                result = JSON.parse(JSON.parse(data))
                                                    }
           });
    
    0 讨论(0)
  • 2020-12-06 11:04

    If you use input check if you have one choice as "selected", if you don´t ie do not pass this parameter to ajax function.

    0 讨论(0)
  • 2020-12-06 11:05

    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!

    0 讨论(0)
  • 2020-12-06 11:05

    I came to this question with similar issues. And answers above fixed many of my problems. However, there's one more trick I need to do. Don't use

    $.ajax({...,
    success: myfunc,...});
    

    use

    $.ajax({...,
    success: myfunc(),...});
    
    0 讨论(0)
  • 2020-12-06 11:07

    Try setting the cached-option to false.

       $.ajax({        
                async: false,
                cache: false, 
                type: "get",
                url:imgsArray[img],
                success:function(imgFile){
                        alert("success");
                        //do something useful
                        },
                        error:function(XMLHttpRequest,status,error){
                        //do nothing
                }
        });//ajax
    
    0 讨论(0)
提交回复
热议问题