-2
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"
});
Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474
amit.mevada
  • 103
  • 10
  • 2
    What do you get? What have you tried? What is your response? – Tim Jan 03 '14 at 12:05
  • 1
    just 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 Answers2

1

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");   
    },
});
Dmitriy.Net
  • 1,476
  • 13
  • 24
0

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.

ChrisSwires
  • 2,713
  • 1
  • 15
  • 28