This question already has an answer here:
I`m trying to get the XML from this link: http://ift.tt/1C2MsY9
Here is my code: The callback always return error
function RequestService() {
$.ajax({
type: "GET",
url: "http://ift.tt/1C2MsY9",
contentType: "application/xml; charset=utf-8",
data: "",
dataType: "xml",
success: function(data) { SucessCallback(data.d); },
error: function(data) { FailureCallBack(data); }
});
}
function SucessCallback(result) {
$('p').html('Resultado: ' + result.Message + ' <br /> Descrição: ' + result.Description);
}
function FailureCallBack(result) {
alert("erro");
}
EDIT: the error in console is:
XMLHttpRequest cannot load http://ift.tt/1C2MsY9. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
No comments:
Post a Comment