Loading an external page in a div using jQuery is as simple as calling the jQuery Load method. The Load() method loads data from the server and places the returned HTML into the matched element.
Assuming you have a Div called ‘divOne’ and an anchor link called ‘ext’. On clicking the anchor, a different page ‘from the same domain’ gets loaded.
See a Live Demo. When you click the link, observe how the entire page loads into this div.
Note: If you are trying load an external page from a ‘different domain’, you would either need to proxify data through your own server or use JSON-P. It will be a cross-domain call. Read this document to learn more.
Tweet
4 comments:
Actually, your example doesn't work - I'm finding that the entire div is replaced with the new content; it doesn't go into the div as expected.
I disagree, it works fine for me.
nope... it doesn't work...
It loads the whole HTML
Post a Comment