Ajax request problem: error 80020101

前端 未结 14 1993
[愿得一人]
[愿得一人] 2020-11-30 13:47

I have a request which returns a jsp page. But the fact is, the jsp includes jsp:include in it(it calls another jsp file in it) and ie gives the error 80020101.

Any

相关标签:
14条回答
  • 2020-11-30 14:05

    I ran into this issue and IE's error messages weren't very helpful. So, I visited my site in Mozilla Firefox and Firefox was able to pinpoint the exact line of code that was problematic. Not a high tech fix but if you have been using just IE for debugging this issue, try loading your site in FF (with the Firebug extension installed) and checking the console output.

    0 讨论(0)
  • 2020-11-30 14:05

    I also ran into this issue, but after taking a close look at my script file, I found out that I made a small mistake that run smoothly on other browser but IE pick it and show me the error:

    My previous code was:

    var autocomplete = new google.maps.places.Autocomplete(searchTextField ,options);
    

    After analyzing, I got that searchTextField is id and I have to get its value before using it

    So I change it to:

    var input = document.getElementById('searchTextField');
    var autocomplete = new google.maps.places.Autocomplete(input,options);
    

    and it works fine.

    That's really cool that IE detects it, but Microsoft may enhance the browser to show specific error for specific cause, because it's very frustrating if same code works in other browsers

    0 讨论(0)
  • 2020-11-30 14:07

    You can also get this error if you're doing an AJAX call from jQuery and you pass an extra comma on the end of the array, like so:

    $.post('http://example.com/example1/',{
      field1:sField1,
      field2:sField2,
      field3:sField3,
      field4:sField4,
      field5:sField5,
    },function(sData){
      if (console) { console.log(sData); }
    });
    

    See that comma after the sField5? That's the syntax error. No other browser will care but IE. IE will throw the obscure 80020101 error (which means "cannot evaluate your Javascript -- you have a syntax error") and it will be practically baffling to chase it down if you're using jQuery because the debugger will merely point to the eval line in jQuery. The IE debugger will be of no use to you to chase this, thanks to Microsoft. The next time you get the 80020101 error, my suggestions are:

    1. Look for any AJAX calls and look for an extra comma.
    2. Look for any arrays (like stuff in curly braces) where there's an extra comma at the end.
    3. If that still doesn't help, then look at the technique where you use <!-- and //--> to mark off your Javascript. This has been a known problem with jQuery up until 1.7.2 and it's still a filed bug with the jQuery team.
    4. Move to the latest version of jQuery.
    5. Start removing stuff piece by piece out of your script block and adding the items in slowly until you find the offending piece of code.
    0 讨论(0)
  • 2020-11-30 14:10

    Wanted to share my experience. In my case it had nothing to do with javascript. It was because of this line in a coworker's HTML that uses angular:

     <img data-ng-model="previewImage" src="" data-ng-src="{{imageURL}}" alt="" ></img>
    

    I remembered that having an empty src is usually a bad thing. I populated the src field and the error went away.

    0 讨论(0)
  • 2020-11-30 14:12

    In my case the problem was additional useless coma in Ajax POST in the end of error function:

    $.ajax({
         type: 'POST',
         dataType: 'text',
         url: '../Client/GetName',
         data: { ClientId: id},
         success: function (respone) {
                    alert(respone);
         },
         error: function (xhr, ajaxOptions, thrownError) {
                    alert(xhr.statusText);
         }, //<- look here, this guy complicated my simple programmer life
     });
    

    After removed it everything works fine.

    0 讨论(0)
  • 2020-11-30 14:12

    I had missed to put 'var' in front of variable declaration, putting that it solved the issue.

    <script>
        uploadDocument = "Some message";
    </script>
    

    I fixed it to :

    var uploadDocument = "Some message";
    

    Root cause was that I had an element in the form with the same id "uploadDocument", hence the above declaration was causing the html to be malformed

    0 讨论(0)
提交回复
热议问题