Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can bind a function to global ajaxerror events<pre><code>$(document).ajaxError(function(event, request, ajaxOptions, thrownError){ if ( 4==request.readyState) { // failed after data has received alert(ajaxOptions['url'] + " did not return valid json data"); } else { alert("something else wnet wrong"); } });</code></pre> or use $.ajax() instead of $.getJSON()<pre><code>function foo() { // $.getJSON("<a href="http://localhost/test.txt" rel="nofollow noreferrer">http://localhost/test.txt</a>", function(data){}); $.ajax({ type: "GET", url: "<a href="http://localhost/test.txt" rel="nofollow noreferrer">http://localhost/test.txt</a>", success: function (data, textStatus) { alert("succuess"); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert("request failed: " + textStatus); }, dataType: "json" }); }</code></pre></p> <p>edit: But you might want to keep in mind that both <a href="http://docs.jquery.com/Ajax/jQuery.ajax#options" rel="nofollow noreferrer">ajax(dataType:"json")</a> and <a href="http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback" rel="nofollow noreferrer">getJSON()</a> (which simply invokes .ajax(dataType:"json") boil down to <code>data = window["eval"]("(" + data + ")")</code> ...this might not be what you want if you don't know what (arbitrary) data your script requests. And this could explain why firebug is catching a syntax error when you feed it an html document instead of json data.<br> In that case better request dataType:"string" und run the data through a fully fledged json parser lib. </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.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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