AJAX navigation in PHP

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Moocat
Forum Contributor
Posts: 143
Joined: Wed Oct 12, 2005 9:28 am
Location: USA

AJAX navigation in PHP

Post by Moocat »

I would like to make a site run almost entirely on Ajax navigation with PHP server side pages. I'm running into a few problems however. I want my main page to stay the same (the div layout page), however when navigating through pages, the variables set on the main page don't persist on the "responseText" that is pulled up through Ajax (since Ajax just pulls the HTML/XML, not an actual page).

Could anyone help me out with this or point me toward a tutorial that could?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

I would seriously advise against using your page navigation ajax based, along with the rest of your site. Ajax should only be used as "upgrade not a downgrade"..

What if your user does not even have javascript available, not to mention your bandwidth is going to shoot through the roof.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

I would concur with Jcart on advising NOT to use it.

but to answer your question:

you'll need to pass the variable information in the form of POST or GET data to the server-side page. From there you can do with it what you want then send it back to the client in a string. What I've done in similar situations is use the split() method to break apart my string and use the different elements of the array accordingly.
User avatar
wtf
Forum Contributor
Posts: 331
Joined: Thu Nov 03, 2005 5:27 pm

Post by wtf »

...your bandwidth is going to shoot through the roof.
How will using ajax negatively affect the bandwidth?
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

if each page has to make multiple requests to the server it should be obvious...
Post Reply