lee lee - 1 year ago 100
Javascript Question

Get content from a specific div that is in another page

ajax and jquery newbie here.

Let's say I want the current page to only get div 3 content that's from another page and load it inside div 1, how do I do that with jquery or ajax? Both page are on the same domain name.


<div id="1"> </div>
<div id="2"> </div>


<div id="3"> </div>
<div id="4"> </div>


You need to make use of jQuery "load" method to load it (like this):

 $('#result').load('exampledomain.com #targetdiv');

Please note there is a space between domain name and #target