Log in

View Full Version : Ajax load different content from a single external page



Neil
02-24-2011, 02:35 PM
Can anyone recommend a script that will load different content from a SINGLE external page?
I have 20+ sections (divs) in a single external page and want to load any one of the divs on demand into its relevant container on the 'main' page depending on the link selected.
The nerest I have found is the Ajax Pagination Script 1.22 but that calls the content from a different page for each link chosen.
I didn't want to declare 20+ different external pages just for a paragraphs worth of content in each. I was envisaging an inline call to just a specific section in one page.
I hope that makes sense.

djr33
02-24-2011, 03:02 PM
That's not easily possible.

You could use Ajax then reparse the contents and look for a div with a certain ID, but it seems messy.

What I would do is use PHP or another serverside language to show only one of the divs. You can use a single page, but use a variable in the URL like ?div=4 to display the 4th div. Then use Ajax to call for one of those divs (actually now acting as separate pages).

In other words, this will be easier to handle on the content page, not the requesting page.

Neil
02-24-2011, 03:58 PM
Thanks djr33 for quick response and thanks for putting the problem into perspective.
Was trying to treat as a flat file db.
Rethink required,
handling on the content page is the way to go.
Cheers