我猜這個問題在本論壇沒有被問到,試過尋找很多但沒有匹配或爲我工作。下面是代碼的jsfiddle鏈接:
一切都在IE8和IE9的工作很好,但沒有在任何其他瀏覽器。我試圖尋找鉻從我得到的問題
XMLHttpRequest cannot load http://v3.actisku.com/GetUserPostData?pid=Test-37&surv=1170. Request header field X-Requested-With is not allowed by Access-Control-Allow-Headers
我試圖尋找必要的解決方案,即CORS,但無法找出解決方案。我並肩尋找相同的東西。
編輯:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<html><head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
var contents = $.ajax({
url: 'http://v3.actisku.com/GetUserPostData?pid=Test-37',
cache: false,
crossDomain: true,
dataType: 'html',
data: { surv: '1170'},
async: false
}).responseText;
var test = contents;
alert(test);
test = test.replace(/\t/g, ';');
alert(test);
test = test.replace(/\n/g, 'break');
alert(test);
$('#contentArea').attr('value', test);
});
</script>
</head>
<body>
<textarea id="contentArea" rows="10" cols="50"></textarea>
</body>
</html>
不能手動,以便服務器感覺就像是從IE本身獲得的請求添加頁眉。
問候, ICR
我在你的小提琴上使用了鉻,並獲得了數據..沒有錯誤的某種... – KyorCode
它在Chrome中爲我工作。您可能需要服務器權限。 – Dev
我也是,我沒有任何問題,當我檢查它 –