I have a post function written in coffeescript below. The intention of the code is to post data to update events then render the view through the fetchEvents function. However, it tends to refresh the view first before it performs the update. I am looking at response time of the post for the issue. Any help would be greatly appreciated. Thanks!
$.get '/artists/' + user_id + '/fetch_events', { event_type: action }, ((event_data) ->
if $.isEmptyObject(event_data)
$.ajax
url: "/events/" + event_id
type: "post"
success: fetchEvents(event_date)
data: "_method": "put", "event" :
"date": event_date
"time": event_time
dataType: "json"
Just top of the head, could it be,
instead of
hope this helps.