Jquery.get() not returning any data

Posted by David Waters on Stack Overflow See other posts from Stack Overflow or by David Waters
Published on 2010-03-13T14:34:42Z Indexed on 2010/03/13 14:35 UTC
Read the original article Hit count: 899

Filed under:
|
|

Hi I am trying to scrape other people web pages (for the forces of good not evil). I am currently trying to do this with javascript/jquery from with in a browser. I am finding that the no data is returned from the jquery.get() success call back function.

My code.

$.get('http://www.google.co.uk/', 
    function (data, textStatus, XMLHttpRequest){ 
        alert("status " + textStatus); 
        alert('data:' + data);
        window.data=data;
        window.textStatus=textStatus;
        window.httpReq = XMLHttpRequest});

In my mind this should simply do a get on google store the data in window.data and we are all good. What happens is we get textStatus == success and data == "". the status on the XMLHttpRequest is 4(success).

I have looked at the network traffic using a transparent proxy (Charles) and everything looks find there http status 200 plenty of data being returned.

I am running this just from the Firebug console in Firefox.

Any ideas?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX