So we have this Javascript function:
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. We've never had an issue with this in Firefox however, so I know it's only IE (8 specifically).
Do you guys know of any way I can get this to work in IE no matter how many calls it needs to make?
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.
Edit: Error coming back from IE -->
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Triden开发者_Go百科t/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. 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.
Probably too many concurrent requests. IE6/7 can handle 2, IE8 can handle up to 6 unless your on dialup, then 2.
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.
Check out the definition of the first variable, maybe the fact you have "xxx" inside another couple of quoting marks. 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.
精彩评论