954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

PHP GET Navigation with AJAX

0
By mikeSQL on Aug 25th, 2007 1:44 am



Home
Portal

Content stuffs.

<html> 
<head> 
<title>AJAX Demo</title> 
<script src='getnv.js'></script> 
</head> 
<body> 
<div id='menu'> 
   <ul> 
      <li><a onClick='check_content("page.php?id=index")'>Home</a></li> 
      <li><a onClick='check_content("page.php?id=portal")'>Portal</a></li> 
   </ul> 
</div> 
<div id='content'>Content stuffs.</div> 
</body> 
</html>

I belive I may have forgotten how to submit this. LOL!

mikeSQL
Junior Poster
196 posts since Dec 2004
Reputation Points: 16
Solved Threads: 3
 

Hi there. I'd appreciate it if you wouldn't steal my tutorial .

JeffSL
Newbie Poster
1 post since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

well i had a few hiccups where it was just echoing the php file so here are the few changes i made to get it all working

<?php
$id = $_GET['id']; 

if ($id == 'index') 
{ 
    echo("This is the INDEX file"); 
} 
if ($id == 'portal') 
{ 
    echo("This is the PORTAL file"); 
} else { 
    echo("No page with that ID exists."); 
}
?>
Auzzie
Junior Poster
122 posts since Nov 2007
Reputation Points: 16
Solved Threads: 16
 
function parseCheck_content(){
if(request.readyState == 1){
document.getElementById('content').innerHTML = 'Loading...';
}


this loading message is good, however not all browsers will be compatible.
ref to http://www.yaldex.com/wAjax/DiggingdeeperintoHTTPreadystates.html
for instance both safari and opera will not be using readyState 1.

what to do to get a loading message? can we use ready state 2 untill 3 ?

Member 785562
Newbie Poster
1 post since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

Hello,

Im sorry. Im new to Php and Ajax.

so how do I call and combine the 3 php file (page.php) with my HTML code?

I know the js is already call and added in the head tag on the HTML but Im a little confuse on how to show it on the page with the php code

I would appreciate a reply. Thanks and have a great day.


Kenn

kosher_12
Newbie Poster
1 post since Oct 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You