jquery.form does not care about status code for success or error callback
I submit a form to my rails controller
- $('#edit_form_submit').live('click', function(e) {
- $('#node_edit_form').ajaxSubmit({
- target : '#node',
- success: function(data, textStatus, xhr) {
- console.log("success");
- },
- error: function() {
- console.log("error");
- }
- });
- return false;
- });
I want to show the user via http-status code if the edit was success or failure but if I send back content allways the success-callback is triggered doesn't matter if http-status code is 4XX
- def update
- @node = Node.find(params[:id])
- @node.update_attributes(params[:node])
- if @node.save
- render :partial => 'edit', :status => :ok
- else
- render :partial => 'edit', :status => :unprocessable_entity
- end
- end
only if I revome the rendered content from the response the error callback is triggered.
is there anything else to send back from the server?
cheers Kai