Page 1 of 1
AJAX navigation in PHP
Posted: Tue Feb 28, 2006 11:25 am
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?
Posted: Tue Feb 28, 2006 11:44 am
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.
Posted: Tue Feb 28, 2006 12:13 pm
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.
Posted: Tue Feb 28, 2006 8:01 pm
by wtf
...your bandwidth is going to shoot through the roof.
How will using ajax negatively affect the bandwidth?
Posted: Tue Feb 28, 2006 8:56 pm
by Burrito
if each page has to make multiple requests to the server it should be obvious...