February 29, 2012

Get HTML source code as a string

Question by user1196522

I want the source code of an HTML page (1.html) to be used in another page (2.html). Further, I want to perform operations on it in 2.html.

Is there a way to do this?

EDIT: 1.html is a seperate public webpage and I do not have access to make changes to its source code. I have to do whatever I need only by using 2.html.

Answer by Starx

Its very simple

On 2.html use this jQuery snippet

$.get("1.html", function(response) { 
    //do you operations

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+


Please fill the form - I will response as fast as I can!