在我的asp.net mvc网站上,当用户在某个文本框中粘贴某些内容时,我正在对我的服务器进行ajax调用.此调用曾在IE 8中工作,但现在它在IE 11中停止工作,在我的jQuery 1.7.1中给了我一个访问被拒绝的异常h.open(c.type,c.url,c.async).
长期研究暗示我可能与CORS问题有关,但......每次通话都在同一个域上.
<input type="text" id="Pasteexcelhere" name="Pasteexcelhere" />
<script type='text/javascript' >
$(function () {
onp();
});
function onp() {
obj = document.getElementById('Pasteexcelhere');
$('#Pasteexcelhere').on('paste', function (e) {
x = obj.value;
$.ajax({
type: "POST",
url: "<%= Url.Action("PasteFromExcel", "RequestData" ) %>",
data: "{'data': '" + x + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
traditional: true,
success: function (da) {
alert("success");
},
error: function (d) {
alert(d.statusText); // access denied
}
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
当试图直接拨打同一个电话时,我们可以通过一个简单的链接说:
<a id="mylink" href="#" onclick="blubb();return …Run Code Online (Sandbox Code Playgroud)