【发布时间】:2015-05-07 10:46:56
【问题描述】:
我正在尝试从返回 JSON 格式数据的网页中检索数据。我正在使用简单的 ajax Jquery 来做同样的事情
$(document).ready(function() {
/*Project Db start Here*/
$.ajax({
url: 'http://enlytica.com/RSLivee/EnClient',
type: 'GET',
dataType: "JSONP",
crossDomain: true,
success: function(data) {
//called when successful
alert("success");
},
error: function(e) {
//called when there is an error
//console.log(e);
alert(e);
}
});
});
但我的 html 页面出现以下错误:
XMLHttpRequest cannot load http://local.html.
No 'Access-Control-Allow-Origin' header is present on the requested
resource. Origin 'null' is therefore not allowed access.
我怎样才能解决这个问题并从链接中获取数据。 提前致谢
【问题讨论】:
标签: jquery json web-services jquery-ajaxq