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

Popular posts from this blog

Using Android Volley to post an array to PHP -

python - How to add an model instance to a django queryset? -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -