简体   繁体   English

多次AJAX调用使IE投诉

[英]Multiple AJAX calls making IE complain

So we have this Javascript function: 因此,我们具有以下Javascript函数:

function GenerateTermSheet()
        {
            var urlString = "<%= System.Web.VirtualPathUtility.ToAbsolute("~/mvc/Indications.cfc/RenderPartialTermSheetView")%>";
            $('#termSheetPopup input[type="checkbox"]:checked').each(function(){
                var checkedName = $(this).attr("name");
                var json = 
                {
                    id : GetGUIDValue(),
                    viewName : checkedName
                }
                $.ajax({
                    type: "POST",
                    url: urlString,
                    async: false,
                    data: json,
                    success: function(data) {
                        $('#termSheetPrinted').append(data + '<br>');
                    }
                });
            })
            $('#termSheetPopup').dialog('close');
            $('#termSheetPrinted').dialog('open');
            $("#termSheetPrinted").jqprint();
        }

When we call this function and it has to loop through a lot of items, IE decides to complain and cut the Javascript process. 当我们调用此函数并且它必须循环许多项时,IE决定投诉并削减Javascript进程。 We've never had an issue with this in Firefox however, so I know it's only IE (8 specifically). 但是,我们在Firefox中从未遇到过此问题,因此我知道它仅是IE(具体为8)。

Do you guys know of any way I can get this to work in IE no matter how many calls it needs to make? 你们知道我可以通过任何方式使它在IE中工作,无论它需要拨打多少电话?

Note: I know sync AJAX is retarded, but we needed it for this specific case so the calls were completed in order, rather then some of the AJAX calls actually made later, completing before ones called earlier. 注意:我知道同步AJAX被延迟了,但是在这种情况下我们需要它,因此调用是按顺序完成的,而不是随后实际进行的一些AJAX调用,是在较早调用之前完成的。

Edit: Error coming back from IE --> 编辑:从IE返回错误->

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
Timestamp: Wed, 16 Mar 2011 19:37:48 UTC


Message: Object doesn't support this property or method
Line: 290
Char: 13
Code: 0
URI: https://extranetint.chathamfinancial.com/mvc/Indications.cfc/results/1373c0e6-2696-4b7a-a911-11a71efcf83b

As for your async problem this maybe of some use http://vimeo.com/12529436 Paul Irish : 10 Things I Learned from the jQuery Source. 至于您的异步问题,这可能会有些用处http://vimeo.com/12529436 Paul Irish:我从jQuery来源中学到的10件事。 If you go through it he mentions a method that you can use it you have to run multiple ajax calls in a specific order. 如果您经历了它,他提到了可以使用它的方法,那么您必须以特定的顺序运行多个ajax调用。

Probably too many concurrent requests. 可能有太多并发请求。 IE6/7 can handle 2, IE8 can handle up to 6 unless your on dialup, then 2. IE6 / 7可以处理2个,除非您使用拨号上网,否则IE8最多可以处理6个。

This kind of error shows up when the code is messed up, I think it´s not a matter of a timeout in the ajax call or something like that. 当代码混乱时会出现这种错误,我认为这不是ajax调用超时或类似问题。

Check out the definition of the first variable, maybe the fact you have "xxx" inside another couple of quoting marks. 检查第一个变量的定义,也许您在另一双引号中包含“ xxx”。 Use something like 使用类似

 var urlString = '<%= System.Web.VirtualPathUtility.ToAbsolute("~/mvc/Indications.cfc/RenderPartialTermSheetView")%>';

And check if that works. 并检查是否可行。 Check also if something else should be escaped in the variable content. 还检查是否应在变量内容中转义其他内容。 Maybe a simple thing could actually do the trick. 也许简单的事情实际上可以解决问题。 Otherwise, the checks on the ajax call shoud be performed as other people said. 否则,应该像其他人所说的那样对ajax调用进行检查。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM