sahmed24
sahmed24

Reputation: 358

$.ajax not working in IE9

I have the following code that is working on Chrome and Firefox, but not in IE9

$.ajax({
  type : type,
  url : url,
  data : reqData,
  crossDomain: true,
  cache: false,
  dataType : dataType,
  contentType : contentType,
  success : successFunction
}).fail(function() {
  showError("IE9!");
});

type is POST, dataType is JSON and contentType is application/json All the other parameters are correct

I've tried removing the contentType, removing the cache, setting cache to true, nothing seems to work

Any thoughts? Thanks in advance

Upvotes: 1

Views: 159

Answers (2)

user2281294
user2281294

Reputation:

you cannot use normal ajax for cross domain access in ie, you have to use XDR for this purpose please refer this link

Upvotes: 2

jmingov
jmingov

Reputation: 14013

Check the url path ( should be absolute ) and make it unique adding a timestamp for example

var url = 'http://mydomain.com/'   ** not '/' **
var timestamp = new Date()
var uniqueUrl = url + (uri.indexOf("?") > 0 ? "&" : "?") + "timestamp=" + timestamp.getTime()

then

url : uniqueUrl,

Upvotes: 0

Related Questions