I am trying to call a webservice which is hosted on my localhost. This AJAX call works for me and I can see the “Authorization” token being sent in the header of the request to the service.
$.ajax({
type: method,
url: serviceUrl,
beforeSend: function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader("Authorization", Token); },
contentType: "application/json; charset=utf-8",
dataType: "json",
ProcessData: true,
cache: false,
success: successHandler,
error: errorHandler
});
But this time I try to call the service which is hosted on Azure Cloud and the same AJAX call works but it does not send the header content.I am using fiddler to inspect the header content of the requests. Is there something I can do so that the header has the “Authorization” token?
It could possibly be a cross-domain policy restriction. You have to make sure the ajax call and the service are within the same domain or you will have to do a little hacking to get it working.