Note that there are some explanatory texts on larger screens.

plurals
  1. PORails render partial Ajax Error BUT correct response shown in Debugger
    primarykey
    data
    text
    <p>I'm trying to trigger an additionnal ajax query on an existing link using unobstrusive Javascript.</p> <p>The Query is going to the server and processed, returning for the test the string "javascript template ok".</p> <p>But, the ajax "success" function is never called. In place, it is the "error" function that is triggered...</p> <p>I looked in the Chrome Debugger and I can see the response text coming back from the server, but never is the "success" method called... :-(</p> <p>My call is </p> <pre><code>jQuery.ajax({ type: 'POST', success: function(response) { $("#details").html(response); console.log(response); }, error: function(){ alert("Error\nData could not be retrieve from the server"); }, url: '/treeview/show/1538.js', cache: false, }); </code></pre> <p>(url is harcoded in this example). The same Url in the browser gets the correct data with no layout :-)</p> <p>Removing the ".js" in the url returns the html template with layout and the update of the "details" div is achieved correctly...</p> <p>The controller is </p> <pre><code> respond_to do |format| format.html # show.html.erb format.js { render :inline =&gt; "JAVASCRIPT TEMPLATE !" } end </code></pre> <p>Thank you </p> <p>EDIT :</p> <p>Here is the object returned from the ajax query (first argument of error: function(jqXHR) ):</p> <pre><code>Object abort: function ( statusText ) { always: function () { complete: function () { done: function () { error: function () { fail: function () { getAllResponseHeaders: function () { getResponseHeader: function ( key ) { overrideMimeType: function ( type ) { pipe: function ( /* fnDone, fnFail, fnProgress */ ) { progress: function () { promise: function ( obj ) { readyState: 4 responseText: "JAVASCRIPT TEMPLATE !" setRequestHeader: function ( name, value ) { state: function () { status: 200 statusCode: function ( map ) { statusText: "OK" success: function () { then: function ( /* fnDone, fnFail, fnProgress */ ) { __proto__: Object </code></pre> <p>So I get the correct response text ??!! Where can be the error then ? :-s</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