$.ajax({
type: "GET",
url: "http://shoperola.com/Restaurant/foodysrest/sample",
crossDomain: true,
cache: false,
dataType: "json",
Complete: function(xhr) {xhr.getResponseHeader("Accept", "json")},
success: function (data, textStatus, xhr) {
console.log(data);
console.log(xhr.getResponseHeader("Content-Length"));
},
error: function (xhr, textStatus, errorThrown) {
console.log(errorThrown+"---"+textStatus);
}
});
此代码返回HTTP状态"200"
,但会触发错误。请任何人建议我如何进行网络服务。
这是错误:
"XMLHttpRequest cannot load http://shoperola.com/Restaurant/foodysrest/sample?_=1389172009980. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://<localhost>:3294' is therefore not allowed access."