0

Hi all,

I have found a code that work perfectly in all browser except IE..Due to my limited knowledge on ajax i couldn't solve the problem.. Hope u guys can help me out =)

<script language="javascript">
function createRequestObject() {

   var req;

   if(window.XMLHttpRequest){
      // Firefox, Safari, Opera...
      req = new XMLHttpRequest();
   } else if(window.ActiveXObject) {
      // Internet Explorer 5+
      req = new ActiveXObject("Microsoft.XMLHTTP");
   } else {
      // There is an error creating the object,
      // just as an old browser is being used.
     alert("Your Browser Does Not Support This Script - Please Upgrade Your Browser ASAP");
   }

   return req;

}

// Make the XMLHttpRequest object
var http = createRequestObject();

function sendRequest(page) {

   // Open PHP script for requests
   http.open('get', page);
   http.onreadystatechange = handleResponse;
   http.send(null);

}

function handleResponse() {

   if(http.readyState == 4 && http.status == 200){

      // Text returned FROM the PHP script
      var response = http.responseText;

      if(response) {
         // UPDATE ajaxTest content
         document.getElementById("msgstatus").innerHTML = response;
      }

   }

}

function repeatloop()
{
sendRequest('testing1.php'); // replace "inbox-status.php" with your php page's url
setTimeout("repeatloop()", 5000);
}

window.onload=function() {
repeatloop();
}
</script>

Then this span to show the content from testing1.php..

<span id="msgstatus"></span>

I think there is something wrong with the activexobject..

Thanks in advanced:D

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by stbuchok
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.