I am getting data by verifying through "jsonp" but it is going to error.
我通过“jsonp”验证数据,但它会出错。
$.ajax({
type: 'GET',
url: _BaseUrl,
contentType: 'application/json;charset=utf-8',
processData: false,
crossDomain: true,
dataType: 'json',
success: function (data) {
sourceGrid = data;
return true;
},
error: function (jqXHR, textStatus, errorThrown) {
alert(jqXHR.error);
return false;
}
});
Error is:
XMLHttpRequest cannot load url. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin url is therefore not allowed access.
XMLHttpRequest无法加载url。请求的资源上不存在“Access-Control-Allow-Origin”标头。因此,不允许访问原始网址。
2 个解决方案
#1
0
Please mention URL you are using for AJAX.. One reason could be you are using full url with http.. Try relative URL.
请提及您用于AJAX的URL。一个原因可能是您正在使用带有http的完整URL。尝试相对URL。
#2
0
I have got the answer.Need to call a class which contains in detail to allow access.
我得到了答案。需要调用一个包含详细信息的类来允许访问。
#1
0
Please mention URL you are using for AJAX.. One reason could be you are using full url with http.. Try relative URL.
请提及您用于AJAX的URL。一个原因可能是您正在使用带有http的完整URL。尝试相对URL。
#2
0
I have got the answer.Need to call a class which contains in detail to allow access.
我得到了答案。需要调用一个包含详细信息的类来允许访问。