Jump to content

alert in AJAX


Recommended Posts


I am checking a value of a variable continuously,if the value exceeds 44 then i should popup an alert  window.

I tried the below code but its not working

<p class = "modify" id="systemp_pos"></p>
    var sys_1;
    function systemp() {

      var xhttp = new XMLHttpRequest();
      xhttp.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) { 
	      document.getElementById("systemp_pos").innerHTML = this.responseText; 
            if(sys_1 > 44 )
            alert("system temperature is increased");
    xhttp.open("GET", "systemp_pos1.txt", true);

    setInterval(systemp, 1000);

Please suggest

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...