0
僅僅是因爲「同源」政策還是因爲編碼本身存在某些問題。我問,因爲我對js是全新的!任何幫助,將不勝感激!爲什麼xmlhttp.status始終爲0?
<html>
<head>
<script type="text/javascript">
function loadXMLDoc()
{
var xmlhttp= new XMLHttpRequest();
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","https://sb-ssl.google.com/safebrowsing/api/lookup?client=demoapp&apikey=KEY&appver=1.5.2&pver=3.0&url=http%3A%2F%2Fklairproducts.com%2Fwp-content%2Fademins.html",true);
xmlhttp.send();
}
</script>
</head>
<body>
<div id="myDiv"><h2>is the link phishing?</h2></div>
<button type="button" onclick="loadXMLDoc()">Lets see</button>
</body>
</html>
您可以發送請求,沒問題。但是你無法訪問響應。 – user123444555621 2011-12-29 11:32:24