Shakeel Ahmed
Shakeel Ahmed

Reputation: 23

I want the returned data to be written to the div tag of the html

<script>
function showPrice(str)
{
if (str=="")
  {
  document.getElementById("remaining").innerHTML="";
  return;
  }
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("remaining").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getevent.php?q="+str,true);
xmlhttp.send();
}
</script>

The following code returns data to the respective div, but when I see the source code I am unable to find the newly inserted code.

Upvotes: 1

Views: 108

Answers (1)

Vince V.
Vince V.

Reputation: 3143

That's because it's added dynamically into the dom. Some browsers show the updated html if you right click and inspect the elements (Chrome and firefox). Others are just showing you the begin version of how it's downloaded.

Upvotes: 1

Related Questions