Copy inside a variable the html of an external link

Here is my previous question: Filter new content to only display specific divs

I would like to get and copy some content from an external page inside a variable. To perform it, I'm using the jquery.get function.

// This code is adding to the div the content

I would like to save the content inside a variable to be able to get only informations that I want

   $.get('ajax/test.html', function(data) {
          // Add to the <div class="result"> the html of data
          // I would like some thing like this
          var result = the html of data 

Thanks for your help


The data variable IS the actual HTML you want...

$.get('ajax/test.html', function (data) {
    var result = data;

Here is a working example

If you then want to use jquery on that HTML data, you must convert it to a JQuery object...

var htmlElement = $(result);
//can now do htmlElement.find(...

Here is an example that pulls the date from the BBC news website

Need Your Help

use dynamic data in dreamweaver CS6 to populate a hyperlink sql variables hyperlink dreamweaver

Basically I have a news page which stores headlines, stories, and a unique story identifier in a SQL database. I want to be able to create a hyperlink on a webpage to the pictures.

How to deal with special characters in URLs inside XML

php javascript xml url special-characters

I have an XML element that has a url as one of it's children, for example:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.