Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ajax request problem: error 80020101

Tags:

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 ideas?

Thanks

like image 643
Ali Avatar asked Feb 07 '11 07:02

Ali


2 Answers

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.
like image 120
Volomike Avatar answered Sep 20 '22 23:09

Volomike


Remove javascript declarations that imports a script using src-attribute. Change your javascript-file to inline-javascript if you really need it there.

Source: http://bytes.com/topic/javascript/answers/750333-ie-syntax-error-80020101-undefined-array

Easiest way to would be to to add a parameter to your AJAX request such as ajax=1 and hide the javascript declarations when ajax -parameter exists is in request.

I don't think this has anything to do with including files with jsp:include since the browser does not know aynthing else than the HTML you throw it with.

like image 36
heikkim Avatar answered Sep 20 '22 23:09

heikkim