Jquery Ajax返回errorError:IE上的访问被拒绝
我下面的代码在Firefox和Chrome上运行得很好,但显示了错误:IE拒绝访问,有人能帮我吗 在Firefox上,它返回Success作为status,在Chrome上返回相同的Success status,但不确定为什么它不能在IE 9.0上工作Jquery Ajax返回errorError:IE上的访问被拒绝,jquery,Jquery,我下面的代码在Firefox和Chrome上运行得很好,但显示了错误:IE拒绝访问,有人能帮我吗 在Firefox上,它返回Success作为status,在Chrome上返回相同的Success status,但不确定为什么它不能在IE 9.0上工作 <html> <head> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <meta charset=u
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<script type="text/javascript">
$(document).ready(function () {
$.support.cors = true;
$('#time').html(new Date());
$('#status').html('');
$('#content').html('');
$.ajax({
cache: false,
url: $('#xhr_url').val()
}).done(function (data, textStatus, jqXHR) {
$('#status').html(textStatus+jqXHR);
$.each(data.T2Json.PrinterManufacturers.Items, function (i, item) {
$("#content").append('<a class="manufacturer" id="' + item.Id + '" onclick="hello(' + item.Id + ');" href="#">' + item.Name + '</a></br>');
});
}).fail(function (jqXHR, textStatus, errorThrown ) {
$('#status').html(textStatus + errorThrown );
$('#content').html('(failed)' + errorThrown);
});
});</script>
</head>
<body>
<input id='xhr_url' style='width:600px;' type='text' value='http://t2json.tgoservices.com/818746/PrinterManufacturers' />
<div id='content1'>ASS</div>
<fieldset>
<legend>Time:</legend>
<div id='time'></div>
</fieldset>
<fieldset>
<legend>Status:</legend>
<div id='status'></div>
</fieldset>
<fieldset>
<legend>Content:</legend>
<div id='content'></div>
</fieldset>
</body>
</html>
JS-Bin
$(文档).ready(函数(){
$.support.cors=true;
$('#time').html(新日期());
$('#status').html('');
$('#content').html('');
$.ajax({
cache:false,
url:$('#xhr_url').val()
}).done(函数(数据、文本状态、jqXHR){
$('#status').html(textStatus+jqXHR);
$.each(data.T2Json.PrinterManufacturers.Items,函数(i,item){
$(“#内容”)。追加(“”);
});
}).fail(函数(jqXHR、textStatus、errorshown){
$('#status').html(textStatus+errorshown);
$('#content').html('(failed')+errorshown);
});
});
屁股
时间:
地位:
内容:
退房
如文件所述,IE9存在已知的问题和限制
注意:使用XDomainRequest对象在IE8和IE9中受到一定程度的支持(但有一些限制)
您可以阅读XDomainRequest限制。我认为问题在于您试图执行跨域请求。您尝试从哪个地址执行ajax请求的页面,以及
$(''xhr_url').val()
的值是多少?它们是否具有相同的协议、域和端口?