Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery.ajax call to Twitter succeeds but returns null for Firefox
    primarykey
    data
    text
    <p>I've got code that makes a simple get request to Twitter (search) using jQuery's Ajax method. The code works fine on Safari, but fails on Firefox (3.6.3). In the Firefox case, my <code>jQuery.ajax</code> parameters 'success' method is invoked, but the supplied data is null. (In Safari, I receive a lot of JSON data.)</p> <p>My Ajax call is:</p> <pre><code>$.ajax({ url: 'http://search.twitter.com/search.json?q='+searchTerm, dataType: 'json', async: true, beforeSend: function(request) { window.console.log('starting AJAX request to get Twitter data'); }, success: function(data, textStatus, request) { window.console.log('AJAX request to get Twitter succeeded: status=' + textStatus); callback(data); }, error: function(request, status, error) { window.console.log('Ajax request to get user data --&gt; Error: ' + status); errback(request, status, error); } }); </code></pre> <p>Firebug shows Response headers:</p> <pre><code>Date Sun, 11 Apr 2010 22:30:26 GMT Server hi Status 200 OK X-Served-From b021 X-Runtime 0.23841 Content-Type application/json; charset=utf-8 X-Served-By sjc1o024.prod.twitter.com X-Timeline-Cache-Hit Miss Cache-Control max-age=15, must-revalidate, max-age=300 Expires Sun, 11 Apr 2010 22:35:26 GMT Vary Accept-Encoding X-Varnish 1827846877 Age 0 Via 1.1 varnish X-Cache-Svr sjc1o024.prod.twitter.com X-Cache MISS Content-Encoding gzip Content-Length 2126 Connection close </code></pre> <p>The HTTP status is OK (200), the Content-Type is properly <code>application/json</code>, and the Content-Length of 2126 (gzip'd) implies data came back. Yet, <a href="http://en.wikipedia.org/wiki/Firebug_%28software%29" rel="nofollow noreferrer">Firebug</a> shows the Response to be empty, and a test of the supplied data shows it to be 'null.'</p> <p>I am aware of a similar post on Stack Overflow, <em><a href="https://stackoverflow.com/questions/1188976">jQuery $.get() function succeeds with 200 but returns no content in Firefox</a></em> and from that would assume this problem is possibly related to cross-domain security, but... I know there are many JavaScript widgets and whatnot that Ajax get data from Twitter. Is there something I need to enable to allow this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload