문제

Is it only because of the 'same-origin' policy or is there something inherently wrong with the coding. I'm asking because I'm completely new to js! Any help would be appreciated!

<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>
도움이 되었습니까?

해결책

You cannot do cross-domain XMLHttpRequests.Thas probably the reasone for 0 xmlhttp.status

다른 팁

Did you get the status 0 in all browsers ?

try it in oldy goldie browsers like IE 7 and set the security level to minimum.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top