Simply returning success or failure from ajax call in rails -
Simply returning success or failure from ajax call in rails -
i have little ajax phone call calls rails:
$.ajax({ type: "post", url: '...', data: ({ ... }), success: function(response, status) { console.log(status); } });
in rails controller i'm deleting entry database, , want homecoming if successful or not. what's best way?
should homecoming json in respond_to? if so, have contain?
best way signify success in way set next in controller...
def destroy # ... code ... respond_to |format| format.json { head :ok } end end
ruby-on-rails ajax json
Comments
Post a Comment