1 Replies - 1516 Views - Last Post: 10 July 2012 - 10:31 AM

#1 fallenreaper  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 240
  • Joined: 19-June 10

does jQuery allow $.ajax() calls in IE? I keep getting errors.

Posted 10 July 2012 - 10:25 AM

Solved.

I have a program which runs and hits a webservice etc, and works with $.ajax for all clients OTHER THEN IE. I need to get it to work in IE and i didnt know if i was suppose to use a XDomainRequest() or if $.ajax would handle IE given a couple flags were set.

Could someone point me in the direction I am looking for? As of right now, I have the following code for an XDR request. I figured there might be a way to make everything work.... possibly in jQuery, but i didnt know who else had come across this. It doesnt even hit a breakpoint in the server code, so it doesn't even ping my server, even though everything is correct.
if ($.browser.msie && window.XDomainRequest) {
                var xdr = new XDomainRequest();
                //var webstring = location.protocol +"//"+ location.host +"/" + WEBSERVICE_URL + "/test";
                var webstring = WEBSERVICE_URL + "/test";
                var openRetVal = xdr.open("GET", webstring);
                xdr.onload = function () {
                    var JSON = $.parseJSON(xdr.responseText);
                    if (JSON == null || typeof (JSON) == 'undefined') {
                        JSON = $.parseJSON(data.firstChild.textContent); 
                    }
                    ajax_success(JSON);
                };
                xdr.ontimeout = function () {
                    alert("XDR Error.  Timeout");
                }
                xdr.onerror = function () {
                    alert("XDR Error.  Unable to do a Cross Domain Server Request.\nOpening Returned Value: " + openRetVal +
                    "\nSend Returned Value: "+sentRetVal);
                };
                var sentRetVal = xdr.send();
                
            } else {
                $.ajax({
                    type: 'GET',
                    url: WEBSERVICE_URL + '/test',
                    dataType: 'json',
                    success: function(result, textStatus, jqXHR){
                        
                        ajax_success(result, textStatus,jqXHR);},
                    error: ajax_error
                });
            }


This post has been edited by fallenreaper: 10 July 2012 - 10:31 AM


Is This A Good Question/Topic? 0
  • +

Replies To: does jQuery allow $.ajax() calls in IE? I keep getting errors.

#2 fallenreaper  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 240
  • Joined: 19-June 10

Re: does jQuery allow $.ajax() calls in IE? I keep getting errors.

Posted 10 July 2012 - 10:31 AM

it works with $.ajax now for IE. I have no idea how. It didnt work at ALL yesterday. and now all of a sudden.... pfft, I hate IE.

This post has been edited by fallenreaper: 10 July 2012 - 10:32 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1