/* Click Event for Goal Completion */ $(".goal_link a").click(function(){ var that = this; $.ajax({ type: "PUT", url: $(this).attr("href"), data: "authenticity_token=#{form_authenticity_token}", success: function(msg){ $(that).parent().parent().parent().parent().parent().hide("slow"); }, error: function(req, status, error){ $("#user_goals_messages").html("We're sorry, but there was a problem updating this goal"); } }); return false; });
This bind event simply performs an ajax call (which would otherwise be sent normally) to mark a "Goal" complete. Upon success it is hidden.
No comments:
Post a Comment