IC SunsetThe developerWorks Connections platform will be sunset on December 31, 2019. On January 1, 2020, this community and its apps will no longer be available. More details available on our FAQ.
Topic
  • 1 reply
  • Latest Post - ‏2014-09-20T11:37:06Z by jitupkp
Sam021
Sam021
1 Post

Pinned topic Ajax

‏2012-02-13T10:06:59Z |
I want to get data from a server and show them. but I cannot do that with
<html>
<head>
<script type="text/javascript">
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","https://plm.repos.se/rppd-vp/rest/deviation/active/",true);
xmlhttp.send();
}
</script>
</head>
<body>

Let AJAX change this text

<button type="button" onclick="loadXMLDoc()">Change Content</button>

</body>
</html>

what is the problem? which code I should use instead?