Connecting Tech Pros Worldwide Forums | Help | Site Map

Get source code of a page from another page

Newbie
 
Join Date: Aug 2008
Posts: 14
#1: Aug 26 '08
hii evry one

I am having two page (page1.html and page2.html)

Is it possible to get the whole source code of page2.html from page1.html
(throu javascript)

For example:

on click event - I need to fetch whole content of the page2.html

Please suggestion me if its possible

Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,660
#2: Aug 26 '08

re: Get source code of a page from another page


I guess, you have to use AJAX.
Expand|Select|Wrap|Line Numbers
  1. // invoke XmlHttpRequest object
  2. XMLhttpRequest.open("POST", "page2.html", true); // this could be the request
  3. // further AJAX code coming here
hope that helps a bit
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,136
#3: Aug 26 '08

re: Get source code of a page from another page


please post javascript-related questions in the javascript-forum ... hopefully a mod of the HTML-forum will move it there so you will get more responses when you ask in the appropriate forum ...

kind regards
MOD
eWish's Avatar
Moderator
 
Join Date: Jul 2007
Location: Arkansas
Posts: 900
#4: Aug 27 '08

re: Get source code of a page from another page


Moving to JavaScript Forum
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,136
#5: Aug 27 '08

re: Get source code of a page from another page


as Dormilich suggested you may use an AJAX-call for such a purpose. post back with something you have tried and/or in case you have any problems with that issue ...

kind regards
Reply


Similar JavaScript / Ajax / DHTML bytes