Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>When running this example, the console displays the empty JSON with the 'Failure' text, which apparently indicates that it considers the JSON to be malformed.</p> </blockquote> <p>In my understanding, this is not what's happening: <strong>The <code>error</code> callback is called because the request failed</strong> (returned a non-200 status) and has nothing to do with the json being invalid (which it isn't).</p> <p>To debug your problem further I suggest the following:</p> <ul> <li>Inspect the http request in your browser and check whether it is actually succeeding (status 200)</li> <li>Inspect your rails log and check that the request is actually succeeding (you should see something like "Completed 200 OK")</li> <li>Do a <code>console.log(data)</code> in both your success and error handler and check what <code>data</code> actually is. At the moment you try to <code>JSON.parse</code> once <code>data</code> and once <code>data.responseText</code>...</li> <li>Read through the documentation: <a href="http://api.jquery.com/jQuery.ajax/" rel="nofollow">http://api.jquery.com/jQuery.ajax/</a> and <a href="http://api.jquery.com/jQuery.get/" rel="nofollow">http://api.jquery.com/jQuery.get/</a>, especially the sections about <code>dataType</code>: if the server returns a proper json response (with correct content type) or if you explicitly set <code>dataType</code> to <code>'json'</code> in the request, then jQuery should parse the response automatically for you and the <code>data</code> object in the callback should already be the parsed response content...</li> </ul>
    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.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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