Skip to content

Instantly share code, notes, and snippets.

@ayato-p
Created April 7, 2014 05:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayato-p/10015136 to your computer and use it in GitHub Desktop.
Save ayato-p/10015136 to your computer and use it in GitHub Desktop.
execute: (form_id, success_proc, fail_proc) ->
$form_obj = $(form_id)
_url = $form_obj.attr('action')
_type = $form_obj.attr('method')
_data = new FormData($form_obj[0])
$.ajax
type: _type
url: _url
processData: false
contentType: false
dataType: 'json'
data: _data
.done (res) ->
return success_proc(res)
.fail ->
return fail_proc()
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment