Created
July 12, 2018 11:34
-
-
Save rava-dosa/45aa9bb34ea00b05f40c8398229b29a4 to your computer and use it in GitHub Desktop.
from.js
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
$(document).ready(function() { | |
$('form').on('submit', function(event) { | |
$.ajax({ | |
data : { | |
name : $('#nameInput').val(), | |
email : $('#emailInput').val(), | |
password : $('#emailInput').val() | |
}, | |
type : 'POST', | |
url : '/admin/process' | |
}) | |
.done(function(data) { | |
if (data.error) { | |
$('#errorAlert').text(data.error).show(); | |
$('#successAlert').hide(); | |
} | |
else { | |
$('#successAlert').text(data.name).show(); | |
$('#errorAlert').hide(); | |
} | |
}); | |
event.preventDefault(); | |
}); | |
}); |
use strict mode
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$(function() {
});