How to get external html page content using jquery or ajax

Viewed 31113

There's this question a friend asked me today and it's bugging me all day long. I have plowwed tens of forums searching for the right way To get an external html content and show it on my page.

I want to address to http://www.someExternalURL.com and to retrieve all the html from this page. I tried the following:

$.ajax
({
    url: "http://www.someExternalURL.com",
    type: "GET",
    cache: false,
    crossDomain: true,
    data: {},
    jsonp: 'jsonCallback',
    dataType: "jsonp",
    success: function (data) {
        alert('good');
        jsonCallback = data.Result;
    },
    error: function (e) {
        alert(e.responseText);
    }
});

Didn't work.

Then I tried:

var all;
$.get("http://localhost:60939/About.aspx", function (my_var) {
    alert(my_var);
}

Only that the latter is good only for local pages. AND I NEED AN EXTERNAL

Any help'd be much appreciated.

Thanks in advance

3 Answers
Related