jQuery.ajax({
type: "POST",
async:false,
url: restURL,
data: params,
crossDomain: true,
headers: { "Authorization": "Basic " + 'aaa'},
success: function(respXML) {
alert("doing stuff");
},
error : function(respXML){
alert("doing stuff");
},
dataType: "text"
});

- 109,027
- 88
- 289
- 474

- 103
- 10
-
2What do you get? What have you tried? What is your response? – Tim Jan 03 '14 at 12:05
-
1just posting code without explaination never works... – A. Wolff Jan 03 '14 at 12:06
-
You have to explain a bit more i'm not sure you looking this http://stackoverflow.com/questions/3362474/jquery-ajax-fails-in-ie-on-cross-domain-calls here it explains good. – Anto king Jan 03 '14 at 12:08
-
possible duplicate of [jQuery AJAX cross domain](http://stackoverflow.com/questions/3506208/jquery-ajax-cross-domain) – Liam Jan 03 '14 at 12:54
2 Answers
Principle
Cross domain ajax request works only with GET request and with jsonp communication technique. When you send ajax request by jsonp, it writes callback parameter in GET url and sent it to your server script. Your script always must return this calback
From jquery ajax description
"jsonp": Loads in a JSON block using JSONP. Adds an extra "?callback=?" to the end of your URL to specify the callback.
If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true. This allows, for example, server-side redirection to another domain
jQuery.ajax({
async:false,
url: restURL,
dataType: 'jsonp',
data: params,
crossDomain: true,
headers: { "Authorization": "Basic " + 'aaa'},
success: function(respXML) {
alert("doing stuff");
},
error : function(respXML){
alert("doing stuff");
},
});

- 1,476
- 13
- 24
If it's just IE then I would suggest enabling cors for jQuery to allow cross origin requests like so:
jQuery.support.cors = true;
Prior to calling .ajax. Ie is stricter than most in it's domain enforcement in my experience with jquery.ajax.

- 2,713
- 1
- 15
- 28