How to load external content to a div using jquery (think embedded lightbox)

user44585 picture user44585 · Feb 26, 2009 · Viewed 27.5k times · Source

Using Thickbox is great it allows me to load external sites into the thickbox and they retain their functionality, appearance, etc. I know how to load simple content into a div with jquery but I am stuck on how to load external content to a div in a page (preferably via onload event) and have that div act like Thickbox and retain the functionality and appearance without the popup thickbox window.

All of the sites are in different child directories but have the same parent.

I hope I explained it well enough.

I am using jquery 1.3.1.

Answer

Shahid picture Shahid · Sep 24, 2011

Using jQuery load function is great.

A simple example of code is $('#result').load('simple/test.html'); where #result is the div where you will load external file and simple/test.html is the html page path to load.

For more info just go to http://api.jquery.com/load/ and follow the instructions.