我正在尝试从返回 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.
我怎么可能解决这个问题并从链接中获取数据。提前致谢