Possible Duplicate:
Ways to circumvent the same-origin policy
I have to call a REST web service from another IP using an AJAX call in an HTML page. However, cross-domain requests aren't supported in AJAX calls.
I am using JSON-P, but I do not get a result in my application.
Here is my jQuery code for making the JSON-P request:
var makePUTRequest = function () {
$.ajax({
type: "POST",
url: "http://
contentType: "application/jsonp",
data: '{"username1":"getStates", "password1":"EXPLORE"}',
dataType: "jsonp",
success: function (response) {
if (response == ("success").toLocaleLowerCase()) {
alert("Loging Successfully!!..");
window.location = "patient_list.html";
}
else {
alert("Please Loging Again!!..");
}
},
beforeSend: function (xhr) {
xhr.setRequestHeader("My-Key", 'MyKey123456789');
},
error: function (error) {
alert("ERROR:", error);
},
complete: function () {
alert("complete");
}
});
};