Okay, so I am very new to this jQuery stuff, and it seems like I'm just going round and round on this... so I'm hoping someone can help.
I have a table that will have a image on each row that when click, it adds a row with more details below the current row. The details will all be pulled from rails.
I am using the DataTables plugin for jQuery for my table and am basing my code off of this example:
http://datatables.net/examples/api/row_details.html
The example adds the row without going to the server, so I have modified fnFormatDetails to hit the server.
my modified code is this:
function fnFormatDetails ( oTable, nTr ) { return jQuery.post('<%= url_for :action=>"field_details" %>', {}, null, 'html'); }
I have also tried multiple variations of this, and can't get anything to work.
I am hitting my action just fine, and it is parsing the view (as seen with log statements), but when the row displays on the screen, I see:
[object XMLHttpRequest]
instead of the text. I have also tried just a plain render(:text=>"some text", :layout=>"false") in my action, and have the same results.
All the documentation I see makes me believe that the $.post method should be returning html.
I have viewed this with FireBug, and it sees the response as the text I gave.
As a side note, I chose to use the $.post method instead of the $.get method because $.get was returning a 304 error. I get the 200 code for $.post.
Also, I have tried this with both jQuery 1.4 and the jQuery instance provided with the plugin.
Thanks in advance! Trish