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

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -