0

This is portion of my index.html

<script type="text/javascript">
function callPortion()
{
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("main").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","welcome.php",true);
xmlhttp.send();
}
</script>
  </head>
  
  <body> 
  
  <a href=# shape="rect" onclick="callPortion()">Gallery</a>
  
  <div id ="main"></div>

...

this is my welcome.php page

<?php
<div>
<p> Welcome! </p>
</div>
?>

How do I make it so that when you click on the gallery link, that it opens displays the php page in the "main" div tags?

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by ddymacek
0

change your php to something like this:

<?php
    $content = "<div>
    <p> Welcome! </p>
    </div>";
	echo $content;
    ?>

tested with your code works as expected.

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.