I am currently working with a form in rails 3, and I am facing a completely strange situation. In principle, the form detects a successful return, but does not detect a 400 error. Here is the code.
JQUERY:
$(".editorial_review").live('ajax:failure', function(xhr, status, error) {
alert('error');
})
.live('ajax:success', function(){$(this).parents('tr').prev('tr.main').fadeOut(); $(this).parents('tr').fadeOut(); });
});
RAILS:
def create
render :json => {:error => 'No Final Status Selected'},:status => 400 and return if params[:status].blank?
@success = send(params[:status].gsub(' ', '_'))
respond_to do |format|
format.js {head:ok}
end
end
Haml:
-semantic_form_for EditorialReview.new, :remote=>true do |f|
I checked in firebug, and everything seems to be kosher, and indeed, when the controller answers head :ok, there is no need to talk about problems.
Any help would be greatly appreciated. Thank!
source
share