Last active
October 29, 2016 02:32
-
-
Save kingthrillgore/7d6adc0666136cfb10dc31b3952a03d7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var BreezeCardInfo = { | |
username: userNameField, | |
password: passwordField, | |
email: emailField, | |
ridesToAdd: ridesToAdd | |
}; | |
// Pull values with the attribute from 'value' | |
// wihin above object | |
$('#FIELD_ID').attr("value"); | |
// During the click event for the submit, you can initalize the above JSON | |
// and pass it along through a promise from $http | |
$(document).ready(function() { | |
var BreezeCardInfo = { | |
username: $('#USERNAME_FIELD').attr("value"), | |
password: $('#PASSWD_FIELD').attr("value"), | |
email: $('#EMAIL_FIELD').attr("value"), | |
email: $('#EMAIL_FIELD').attr("value"), | |
ridesToAdd: $('#RIDES_FIELD').attr("value") | |
}; | |
var data = JSON.stringify(BreezeCardInfo); | |
$('#formSubmit').click(function() { | |
$.post('DESTINATION_URL', BreezeCardInfo, function(data) { | |
console.log("Operation Run.."); | |
}).done(function(data) { | |
console.log("Second Operation Run.."); | |
}).fail(function(data) { | |
console.log("Failure"); | |
}).always(function(data) { | |
console.log("This Promise Always Runs"); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment