Ajax请求问题:错误80020101
我有一个返回 jsp 页面的请求。但事实是,jsp 中包含 jsp:include (它调用其中的另一个 jsp 文件),并且 ie 给出错误 80020101。
有什么想法吗?
谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(14)
如果您从 jQuery 进行 AJAX 调用并且在数组末尾传递了一个额外的逗号,您也可能会收到此错误,如下所示:
看到 sField5 之后的逗号了吗?这就是语法错误。除了 IE 之外,没有其他浏览器会关心。 IE 将抛出晦涩难懂的 80020101 错误(这意味着“无法评估你的 Javascript——你有一个语法错误”),如果你使用 jQuery,那么追踪它实际上会令人困惑,因为调试器只会指向 eval 行在 jQuery 中。感谢微软,IE 调试器对你来说是没有用的。下次您收到 80020101 错误时,我的建议是:
来标记 Javascript 的技术。在 1.7.2 之前,这一直是 jQuery 的一个已知问题,并且仍然是 jQuery 团队提交的错误。
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:
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:
<!--
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.删除使用 src-attribute 导入脚本的 javascript 声明。如果您确实需要的话,请将您的 javascript 文件更改为 inline-javascript 。
来源: http: //bytes.com/topic/javascript/answers/750333-ie-syntax-error-80020101-undefined-array
最简单的方法是向 AJAX 请求添加参数,例如 ajax= 1 并在请求中存在 ajax 参数时隐藏 javascript 声明。
我认为这与使用 jsp:include 包含文件没有任何关系,因为浏览器除了您抛出的 HTML 之外不知道其他任何东西。
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.
我现在已经在 jQuery(甚至是最新版本)中遇到过这个问题两次。唯一的解决方案是将所有 JavaScript 复制并粘贴到一个大文件中,然后通过 JSLint(jsfiddle.net,首选)运行它。它能够指出几个小错误(包括我的数据回调结构之一中的额外逗号),我能够修复这些错误,然后重新复制并粘贴回原来的位置以消除问题。
http://jsfiddle.net/devlshone/QKxup/3/
I have now come across this problem with jQuery (even the latest version) twice. The ONLY solution is to copy and paste all of your javascript into one big file and run it through JSLint (jsfiddle.net, preferred). It was able to point out several minor errors (including an extra comma in one of my data callback structures) that I was able to fix and then re-copy and paste back into their original places to eliminate the issue.
http://jsfiddle.net/devlshone/QKxup/3/
我遇到了同样的错误,但就我而言,有一个保留字
'class'
。下面是一段代码,可以清楚地说明这一点:
我将其重写为:
希望这有帮助。
I had the same error, but in my case there was a reserved word
'class'
.Here is a snippet of code to make this clear:
I rewrote this as:
Hope this was helpful.
就我而言,我发现我的 JS 代码中有一个 HTML 注释:
我将
替换为
/* */
并且它有效。希望它能帮助某人。
In my case I found that there was an HTML comment in my JS code as:
I replaced
<!-- -->
with/* */
and it worked.Hope it will help someone.
我遇到了这个问题,IE 的错误消息没有太大帮助。因此,我在 Mozilla Firefox 中访问了我的网站,Firefox 能够准确定位有问题的代码行。这不是高科技修复,但如果您仅使用 IE 来调试此问题,请尝试在 FF 中加载您的站点(安装了 Firebug 扩展)并检查控制台输出。
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.
我也遇到了这个问题,但是仔细查看我的脚本文件后,我发现我犯了一个小错误,在其他浏览器上运行顺利,但 IE 选择它并向我显示错误:
我以前的代码是:
分析后,我知道
searchTextField
是 id,我必须在使用它之前获取它的值,所以我将其更改为:
并且它工作正常。
IE 检测到它确实很酷,但微软可能会增强浏览器以显示特定原因的特定错误,因为如果相同的代码在其他浏览器中运行,那将非常令人沮丧
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:
After analyzing, I got that
searchTextField
is id and I have to get its value before using itSo I change it to:
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
就我而言,问题是错误函数末尾的 Ajax POST 中额外无用的昏迷:
将其删除后,一切正常。
In my case the problem was additional useless coma in Ajax POST in the end of error function:
After removed it everything works fine.
你有机会包含一个js文件吗?
因为
错误 80020101 意味着 IE 无法编译您的脚本。
Are you by any chance including a js file ?
Because
Error 80020101 means that IE isnt't able to compile your script.
使用 jquery 时因不同问题而出现此错误。
改变
$(document).ready(function(){});
到
$(window).load(function(){});
Got this error for a different issue while using jquery.
Change
$(document).ready(function(){});
TO
$(window).load(function(){});
想分享我的经验。就我而言,它与 javascript 无关。这是因为同事的 HTML 中使用 Angular 的这一行:
我记得有一个空的 src 通常是一件坏事。我填充了 src 字段,错误就消失了。
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:
I remembered that having an empty src is usually a bad thing. I populated the src field and the error went away.
我在使用 jQuery 1.10.2 并加载不存在的文件时遇到了此错误。
因此请确保您尝试加载的文件是正确的,否则 IE8 会抛出 80020101 错误。
I experienced this error when using jQuery 1.10.2 and was loading a file that didn't exist.
So make sure the file you try to load is correct, otherwise IE8 can throw the 80020101 error.
我的问题是由以下原因引起的:
转向
现在它工作正常!
再见
硕士
My issues were caused by:
turned to
Now it works fine!
Bye
MA
我错过了将“var”放在变量声明前面,认为它解决了问题。
我将其修复为:
根本原因是我的表单中有一个具有相同 id“uploadDocument”的元素,因此上述声明导致 html 格式错误
I had missed to put 'var' in front of variable declaration, putting that it solved the issue.
I fixed it to :
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