Skip to content Skip to sidebar Skip to footer

Displaying An Html Popup Using Ajax

I'm trying to make an HTML page that displays another html file in an alert; but it's not displaying when the triggering button is pressed. &l

Solution 1:

In fact it's readyState. JavaScript is case-sensitive.

Also, it might be better to send after setting up everything.

Lastly, you have a missing }.

var xmlhttp=newXMLHttpRequest();

functionpop()
{
 xmlhttp.open("GET","content.html",true);
 xmlhttp.onreadystatechange=function()
 { if(xmlhttp.readyState==4&&xmlhttp.status==200)
    {alert(xmlhttp.responseText);}
 }
 xmlhttp.send();
}

Solution 2:

Yep, i'm counting three opening braces ({) but only two closing braces (}). Check your browser's error console to spot such errors.

Solution 3:

Check Below: Closing bracket is missing.

var xmlhttp=new XMLHttpRequest();

functionpop()
{
   xmlhttp.open("GET","content.html",true);
  xmlhttp.send();
  xmlhttp.onreadystatechange=function()
  {

if(xmlhttp.readystate==4&&xmlhttp.status==200)
   {
    alert(xmlhttp.responseText);
   }
  }
}

Post a Comment for "Displaying An Html Popup Using Ajax"