Included below is the code that I am trying to use to display the HTML contents of another page. I am unable to get the code to work and am receiving an error each time. What am I missing here?
$.ajax({
url: 'http://www.msn.com',
type: 'GET',
dataType : "text/html",
success: function (result) {
alert('success');
alert(result);
},
error: function() {
alert('error');
}
});
You cannot do a cross-domain AJAX request (unless the servers are specifically set up for it).
The best you can do is call a PHP script on your server, which in turn gets the HTML from the other server and sends it back to your page.