Internet Explorer Ajax Error
Reviews Videos DealPost Resources/White papers Stay connected Newsletters RSS × Close Home Software Development ByteStream By Matthew Mombrea Follow AJAX requests not executing or updating in Internet Explorer? Here's a solution More good reads REST Web services demystified 10 essential WordPress plugins 7 apps making the most of HTML5 on IDG Answers Should we stop using Internet Explorer until the newest fix is released? DealPosts $29 for This Premium 4-Course Training on Amazon Web Services- Deal Alert Debugging and fixing stale AJAX data issues in Internet Explorer Email a friend To Use commas to separate multiple email addresses From Privacy Policy Thank you Your message has been sent. Sorry There was an error emailing this page. ITworld | October 15, 2012 RELATED TOPICS Development Software Here’s the situation, you’re building a modern web application with all the AJAX-ey goodness users now expect, when suddenly you realize that some of your AJAX calls are not returning current data in Internet Explorer. If you’re like me, this usually dawns on you toward the end of a project while you’re testing because, well, what self respecting developer uses IE on a daily basis?This can be a frustrating issue to debug. It’s possible though that this is a very common problem. In fact, it cropped up in my office three times over the past 2 weeks!The Symptoms Requests work just fine the first time you try As data is modified, you realize that you’re still seeing old results Everything appears to work correctly in other browsers You’re slowly going insane DebuggingWhen an issue of this nature pops up I usually start the investigation by using FireBug in Firefox. Using this invaluable tool I check to make sure the requests are being made properly, check for any response issues, and so forth.With Internet Explorer, the development tools are so poor you can barely debug CSS issues, let alone javascript problems. It’s the
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up IE not triggering jQuery Ajax success up http://www.itworld.com/article/2693447/ajax-requests-not-executing-or-updating-in-internet-explorer-solution.html vote 11 down vote favorite 2 I'm working on a script to load some images async using jQuery. Here is a code snippet of the function that loads the images - try{ for(img in imgsArray){ $.ajax({ async: false, type: "get", url:imgsArray[img], success:function(imgFile){ alert("success"); //do something useful }, error:function(XMLHttpRequest,status,error){ //do nothing } });//ajax } } catch(e){ //oops } I have tested this in Firefox, Webkit (Safari,Chrome) and http://stackoverflow.com/questions/782532/ie-not-triggering-jquery-ajax-success it works. The images are in a folder on the server and I'm using jQuery 1.3. any ideas? jquery ajax internet-explorer share|improve this question edited Apr 1 '15 at 17:42 Dominick Piganell 4211418 asked Apr 23 '09 at 16:32 Peter 1,87742038 I presume you've already looked at the response in Fiddler? What do you see there? –Craig Stuntz Apr 23 '09 at 16:45 Does the error function get hit? You should put some code in there to see what the error is if anything. –Damovisa Apr 24 '09 at 0:03 yeah, add an alert in your catch to see if it's throwing an error. Also may want to change it to "GET" not "get" –Chad Grant Apr 24 '09 at 2:19 Thanks for the help. I appreciate it. –Peter Apr 24 '09 at 10:04 add a comment| 11 Answers 11 active oldest votes up vote 13 down vote accepted A simple fix of this problem is to provide the jQuery setting dataType : 'text' or dataType : 'xml' or dataType : 'json' or any other available response type. I had same problem, but it's working fine after specifying the dataT
Programming, Technology, Web Programming & Development with 25 comments I've written previously on how to handle AJAX requests for Internet Explorer but recently we came across a strange issue where the http://cypressnorth.com/programming/internet-explorer-aborting-ajax-requests-fixed/ requests were being aborted by IE before the response was finished being delivered. Using Fiddler and Firebug, we were able to see that the request was being made properly, and even the response https://coderanch.com/t/568772/HTML-CSS-JavaScript/jQuery-ajax-chrome was coming back properly, but at some point, IE would simply stop accepting the data if it was not a very short response. The problem was even more perplexing because it did internet explorer not happen every time and it did not happen the same in all versions of IE, in fact IE 9 had more difficulty than IE 7. You might be familiar with the typical way of making an AJAX request using XDR for Internet Explorer. It would generally look like the following: //USING JQUERY if ($.browser.msie && window.XDomainRequest) { // Use Microsoft XDR var xdr = internet explorer ajax new XDomainRequest(); xdr.open("get", "someurl"); xdr.onload = function () { var JSON = $.parseJSON(xdr.responseText); if (JSON == null || typeof (JSON) == 'undefined') { JSON = $.parseJSON(data.firstChild.textContent); } processData(JSON); }; xdr.send(); } The process goes like this: Create the XDomainRequest object Define the request type (GET,POST) and the request path (URL) in .open() Define an event handler to capture the response in .onload() Send the request using .send() Depending on what you are returning, this is usually all you need.If you run into the problem that we were having, you need to do a little more to fix it. The Solution The problem has to do with IE timing out the request even though data is being transmitted. By defining some additional event handlers and specifying a timeout value of 0, IE will not abort the request prematurely. Your mileage may vary but for us the solution was to define the following handlers as empty: xdr.onprogress = function () { }; xdr.ontimeout = function () { }; xdr.onerror = function () { }; Then wrap the send() function in a timeout declaration: setTimeout(function () { xdr.send(); }, 0); Producing the final resulting XDR call
Certification Databases Caching Books Engineering Languages Frameworks Products This Site Careers Other all forums Forum: HTML, CSS and JavaScript jQuery.ajax() issue with chrome and IE 8 Gaurav Chander Greenhorn Posts: 10 posted 4 years ago Hello All, I am working on an application in which I need to populate dropdowns on the basis on previous selection from drop down. code is working fine in mozilla but it fails in Internet explorer and chrome here is the explained scenario function populateAdvertiser(){ var value = $("#accType").val(); var url = '${pageContext.request.contextPath}/Graph/getAdvertiser.xads?acc_type='+value; jQuery.ajax({ type : "GET", url : url, dataType : "json", cache:false, success : function(data) { for ( var i = 0; i < data.length; i++) { a = data[i].value; b = data[i].name; jQuery("#advertiser").append(jQuery('').val(b).html(a)); } }, error : function(XMLHttpRequest, textStatus, errorThrown) { alert('Unexpected server error'); } }); } above javascript function calls a java method and in return receives a json of format name:value i have checked the json on multiple websites and they say it is correct but i'm not able to populate the select list in IE8, it goes to error and give the alert Unexpected server error. i have tried setting cache: false, async:false contentType in java is set to application/json. don't know where I'm going wrong. also in chrome above function works fine but there is a similar function for another dropdown which fails. in case of chrome request does not even goes to the servlet. both function are working fine in mozilla any help would be appreciated. PS: IE version is 8 and chrome version is 17.0.963.56 thanks. Gaurav Chander Greenhorn Posts: 10 posted 4 years ago on checking the data in firebug i found a special character 'é' was there which was casing parsing issues in IE. so it is resolved.. Gaurav Chander Greenhorn Posts: 10 posted 4 years ago so now i'm only stuck with chrome issue.. chrome is not sending request to controller.. please suggest for that.. Bear Bibea