Note that there are some explanatory texts on larger screens.

plurals
  1. POAJAX success handler not being invoked
    primarykey
    data
    text
    <p>I am trying to perform an AJAX request to a Play application on Heroku from my local machine. Currently, the <code>'complete'</code> and <code>'error'</code> handlers are being invoke but not the <code>'success'</code>. In Opera and Firefox, my response headers are:</p> <pre><code>HTTP/1.1 200 OK Cache-Control: no-cache Content-Type: application/json; charset=utf-8 Server: Play! Framework;1.2.4;prod Set-Cookie: PLAY_FLASH=;Expires=Fri, 5-Oct-12 08:22:46 GMT;Path=/ Set-Cookie: PLAY_ERRORS=;Expires=Fri, 5-Oct-12 08:22:46 GMT;Path=/ Set-Cookie: PLAY_SESSION=;Expires=Fri, 5-Oct-12 08:22:46 GMT;Path=/ Content-Length: 2295 Connection: keep-alive </code></pre> <p>Opera also shows the returned JSON object</p> <p>Here is my code:</p> <pre><code>var url = "http://myurl.com" $.ajax({ 'complete': function (jqXHR, status) { console.log('Complete!'); console.log(status); console.log(jqXHR.getAllResponseHeaders()); }, 'dataType': "application/json", 'error': function (jqXHR, status, error) { console.log('Error!'); console.log(status); console.log(error); }, 'success': function (data, status, jqXHR) { console.log('Success!'); console.log(status); console.log(data); }, 'type': 'GET', 'url': url }); </code></pre> <p>Other similar questions suggested changing the datatype to text or removing it altogether: neither work. I have successfully validated the returned JSON object at <a href="http://jsonlint.com/" rel="nofollow">JSONLint</a>.</p> <p>The console log is:</p> <pre><code>Error! error Complete! error </code></pre> <p>I'm not sure if it is linked, but the <code>getAllResponseHeaders()</code> function is returning an empty string.</p> <p>Is this a cross domain error?</p> <p>Any help is welcome!</p> <p>Thanks</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.
 

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