Skip to content

Instantly share code, notes, and snippets.

@xShirase
Created October 10, 2014 03:06
Show Gist options
  • Save xShirase/bc6e6543d00ae7576a72 to your computer and use it in GitHub Desktop.
Save xShirase/bc6e6543d00ae7576a72 to your computer and use it in GitHub Desktop.
<script type = "text/javascript">
$(document).ready(function() {
$('form').on('submit', function(e){
e.preventDefault()
$.ajax({
type: 'POST',
url: '/login',
data: {
username: $('#us').val(),
password: $('#pass').val()
},
success: function(result) {
if (!result) {
//$('form input[name="username"]').css("background-color", "red");
console.log(result);
}
},
error: function(xhr, ajaxOptions, thrownError) {
console.log(xhr.status);
console.log(thrownError);
}
});
});
});
< /script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment