View Full Version : AJAX help needed: specifying a target DIV in ajax call

02-25-2011, 08:59 AM
1) Script Title: Dynamic Ajax Content

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

3) Describe problem:

An addition to this script was added here (http://www.dynamicdrive.com/forums/showthread.php?t=60951&goto=nextoldest) that allows you to fetch only the content from a specific <div> on the target page, which is very useful. The DIV ID is specified in the Javascript file and not in the markup on the original HTML page.

Is there a way of including a variable in the HTML link that specifies the DIV ID on the target page?

Something like this:

<a href="javascript:ajaxpage('ExternalPage.html #SpecificDIV', 'rightcolumn'); loadobjs('Style.css');">Link1</a>

...where "#SpecificDIV" was the name of a specific DIV on the target page.

This would allow there to be multiple links on the page without attaching multiple versions of the Javascript file.

I hope I phrased that okay. I'm new to Javascript and Dynamic Drive.

Thanks everyone for a totally awesome resource.