JQuery.ajax success function returns empty

Posted by viatropos on Stack Overflow See other posts from Stack Overflow or by viatropos
Published on 2010-05-05T01:19:09Z Indexed on 2010/05/05 1:28 UTC
Read the original article Hit count: 288

Filed under:
|
|
|

I have a very basic AJAX function in JQuery:

$.ajax({
    url: "http://www.google.com",
    dataType: "html",
    success: function(data) {
        alert(data);
    }
});

But the data is always an empty string, no matter what url I go to... Why is that? I am running this locally at http://localhost:3000, and am using JQuery 1.4.2.

If I make a local response, however, like this:

$.ajax({
    url: "http://localhost:3000/test",
    dataType: "html",
    success: function(data) {
        alert(data);
    }
});

...it returns the html page at that address. What am I missing here?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX