Note that there are some explanatory texts on larger screens.

plurals
  1. POIE won't load JSON and tries to download root file! (I'm following a tutorial which works on all other browsers)
    text
    copied!<p>I'm following a tutorial using $.ajax, jsonp, and the twitter API. </p> <p>The example works on all browsers except for IE, unfortunately. And I when I try to load the twitter URL (<a href="http://search.twitter.com/search.json?q=bowery" rel="nofollow">http://search.twitter.com/search.json?q=bowery</a>) into an IE browser, IE attempts to <em>download</em> the file. </p> <p>I tried to fix this by adding <strong>contentType: 'text/plain',</strong> under <strong>dataType: 'jsonp',</strong>, as well as <strong>contentType: 'text/html'</strong>, and <strong>contentType: 'text/javascript'</strong>, but none of those variations have worked. Has anyone solved this jsonp + IE + $.ajax issue before?</p> <p>Tutorial code on github: <a href="https://github.com/troyth/webassite.com/blob/master/tutorials/tutorial4/index.html" rel="nofollow">https://github.com/troyth/webassite.com/blob/master/tutorials/tutorial4/index.html</a>. </p> <p>Javascript:</p> <pre><code>&lt;script src="http://code.jquery.com/jquery-1.9.0.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { console.log('doc ready!'); var search_term = { q: 'harrypotter' }; search(search_term); }); function search(search_term) { $.ajax({ url: 'http://search.twitter.com/search.json?' + $.param(search_term), dataType: 'jsonp', success: function(data) { for (item in data['results']) { $('#tweets').append( '&lt;li&gt;' + data['results'][item]['text'] + '&lt;/li&gt;'); } } }); } </code></pre> <p> </p> <p>HTML:</p> <pre><code> &lt;ol id="tweets"&gt;&lt;/ol&gt; </code></pre>
 

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