I’d like to load a portion of external website content using jQuery and AJAX, as I have read that you can do this. I’d only like to load a portion of the website as explained in this post iframe to Only Show a Certain Part of the Page .
I have full copyright permission to the site I’m trying to load.
Thanks,
etrey
For this you can create a div in your main page
Then in your JS code mention the following line
Here you have to replace
https://www.google.co.inwith the target URL. And replaceDIVNAMEwith the target div id in the target page.UPDATE:
This method will not work if you are accessing a page in different domain because of security issues. In that case you can do the following
New Server-side Page (say GetContent.aspx)in your webapplication (so that the domain will be same).
domain) and extract the required section. If you are not able to extract the section, load the complete page.
New Server-side Page (sayGetContent.aspx)
Now you can show this
GetContent.aspxusing.loadfunction. If you are using the complete page (without extracting) then use the following code for loading the required content div.$(‘#iframediv’).load(‘https://www.google.co.in #DIVNAME’);