Note that there are some explanatory texts on larger screens.

plurals
  1. POjson Uncaught SyntaxError: Unexpected token :
    primarykey
    data
    text
    <p>Trying to make a call and retrieve a very simple, one line, JSON file.</p> <pre><code>$(document).ready(function() { jQuery.ajax({ type: 'GET', url: 'http://wncrunners.com/admin/colors.json' , dataType: 'jsonp', success: function(data) { alert('success'); } }); });//end document.ready </code></pre> <p>Here's the RAW Request:</p> <pre><code>GET http://wncrunners.com/admin/colors.json?callback=jQuery16406345664265099913_1319854793396&amp;_=1319854793399 HTTP/1.1 Host: wncrunners.com Connection: keep-alive Cache-Control: max-age=0 User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.106 Safari/535.2 Accept: */* Referer: http://localhost:8888/jquery/Test.html Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 </code></pre> <p>Here's the RAW Response:</p> <pre><code>HTTP/1.1 200 OK Date: Sat, 29 Oct 2011 02:21:24 GMT Server: Apache/1.3.33 (Unix) mod_ssl/2.8.22 OpenSSL/0.9.7d SE/0.5.3 Last-Modified: Fri, 28 Oct 2011 17:48:47 GMT ETag: "166a2402-10-4eaaeaff" Accept-Ranges: bytes Content-Length: 16 Content-Type: text/plain Connection: close {"red" : "#f00"} </code></pre> <p>The JSON is coming back in the response (red : #f00), but Chrome reports <strong>Uncaught SyntaxError: Unexpected token : colors.json:1</strong></p> <p>If I navigate directly to url itself, the JSON is returned and is displayed in the browser.</p> <p>If I paste the contents of colors.json into JSLINT, the json validates.</p> <p>Any ideas why I can't get this error and I never make it to the success callback?</p> <p><strong>EDIT</strong> - the jQuery.ajax() call above runs perfect at jsfiddle.net, and returns the alert 'success' as expected. </p> <p><strong>EDIT 2</strong> - this URL works fine 'http://api.wunderground.com/api/8ac447ee36aa2505/geolookup/conditions/q/IA/Cedar_Rapids.json' I noticed that it returned as TYPE: text/javascript and Chrome did not throw the Unexpected Token. I've tested several other url's and the ONLY one that does not throw the Unexptected Token is the wunderground that is returned as TYPE: text/javascript. </p> <p>Streams returned as text/plain and application/json are not being parsed correctly.</p>
    singulars
    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