Created
September 21, 2017 18:16
-
-
Save valterbarros/ee0f1fd0eb375790a5097d52ce5a68de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on_submit_form: () -> | |
plannings = $('#plannings-selected').serialize() | |
company = $('#company-section-form').serialize() | |
form = $('#contract-form') | |
$('#add-item').off().click (e) -> | |
#form.trigger('submit') | |
e.preventDefault() | |
e.stopImmediatePropagation() | |
dataForm = new FormData($('form')[0]) | |
dataForm.append('plannings', plannings) | |
dataForm.append('company', company) | |
console.log company | |
$.ajax { | |
url: $('form')[0].action, | |
data: dataForm, | |
processData: false, | |
contentType: false, | |
type: 'patch', | |
success: -> | |
alert('success') | |
fail: -> | |
alert('fail') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment