Created
November 17, 2011 11:19
-
-
Save kirs/1372942 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
$('#new_user').submit (e) -> | |
e.preventDefault() | |
data = $(e.target).serializeArray() | |
$.ajax | |
type: "POST" | |
data: data | |
dataType: "json" | |
url: $(e.target).attr('action') | |
success: (res) -> | |
window.location += "" | |
statusCode: | |
422: (res) -> | |
errors = JSON.parse(res.responseText) | |
_.each(errors, (value, key)-> | |
console.log key | |
console.log value[0] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment