我们正在开发一个使用html5,jQuery(1.8.2)和jQuery mobile的移动网站,同时进行jQuery ajax调用(get和post).
在我们更改了域名后,我们对ie9上的ajax调用进行了"拒绝访问".
我们试图包括jquery.iecors.js.但我们仍然得到同样的错误.这有什么解决方案吗?
示例代码:
$.support.cors = true;
$.ajax({
cache: false,
async: true,
crossDomain: true,
timeout: 600000,
url: baseUrl + '/SmartTouch/restServices/PrefferedHotels',
type: 'GET',
beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization", "Basic " + myencoded);
},
contentType: "application/x-www.form-urlencoded; (http://www.form-urlencoded;) (http://www.form-urlencoded;) charset=UTF-8",
success: function (data) {
alert("success");
},
error: function (jqXHR, textStatus, errorThrown) {
alert("error!!::" + JSON.stringify(jqXHR));
alert('response: ' + jqXHR.responseText);
alert('code: ' + jqXHR.getResponseHeader('X-Subscriber-Status'));
alert("textStatus " + textStatus);
alert("errorThrown " + errorThrown);
}
});
Run Code Online (Sandbox Code Playgroud)
编辑:
beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization", …Run Code Online (Sandbox Code Playgroud) 我正在使用传单绘制来创建多边形.我的要求是当用户绘制多边形时,它不应与现有多边形相交/重叠.我已经使用多边形小叶中的点来检测点是否落在多边形内并且它正在工作,但问题是我无法检测到一条线是否穿过另一个多边形.在这种情况下,点位于现有多边形之外但存在重叠.
下面附图可以给出更好的图片!