I have a Rails application where I have some ajax calls, it usally works just fine, but this one I can get working:
I tried running the rails class from the browser, works fine, and I tried calling an alert with the params just before the ajax call, works fine.. but no connection, whats wrong?
jQuery:
$.ajax({
url: "things/ajax_text_read",
data: "book_id=" + book_id + "&page_number=" + page_number + "&type="+ type,
success: function(){$(this).text('data'); }
});
Rails:
def ajax_text_read
@book_id = params['book_id']
@page_number = params['page_number']
@type = params['type']
@text = Thing.where(:parent_id => @page_number, :book => @book_id, :media_type => 'text')
if(@type=='description')
render :inline => "<%= @text[0].description %>"
else
render :inline => "<%= @text[0].title %>"
end
end