Setting Up for Ajax with PHP
Not sure if this is the right place to post, but I have an existing static page that I'd like to break up into chunks in order to 'ajax-ify' my site, but I'm not sure the best way to go about it. I basically have links that correspond to content in a container div. I'd like to be able to swap the content in the container div accordingly with the help of ajax.
What I'm stuck on is how exactly to separate it all. I'm thinking what I'd do is separate the content into different php pages and attach an ajax 'get' request to the links that gets the corresponding php page. If this is the correct way to go about it, how do I separate with php? Is it as simple as wrapping the DOM elements with a php tag and saving such as this:
or do I need to use some kind of include(); function?
<div id="content_1" class="content">blah blah blah</div>;
Then I assume I'd have to set up an index.php page that collects all the separated php pages, but I'm not sure how'd I go about writing that either.
I hope this is clear, I can mock up an example html file if it's too hard to follow?