ajax request internal server error
Posted
by
joe
on Stack Overflow
See other posts from Stack Overflow
or by joe
Published on 2011-06-21T20:08:31Z
Indexed on
2011/06/22
0:22 UTC
Read the original article
Hit count: 107
jQuery
|ruby-on-rails
Everything is working good on local but when i try same codes in production, i get 500 (Internal Server Error) error.
entries.controller
def set_spam
@entry = Entry.find(params[:entry_id])
@entry.spam = params[:what] == "spam" ? true : false
@entry.save
respond_to do |format|
format.js
end
end
application.js
$(".entry-actions .spams img").click(function () {
$.post("/set-spam", { entry_id: $(this).attr("entry_id"), what: $(this).attr("class") } );
return false;
});
view
<div class="spams">
<img title="spam" class="spam" src="/images/pixel.gif" entry_id="<%= entry.id %>" />
</div>
route
post "/set-spam" => "entries#set_spam"
© Stack Overflow or respective owner