Created
March 19, 2016 01:37
-
-
Save marco-mendes/b68d3674b259137dfd89 to your computer and use it in GitHub Desktop.
index.html
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
<!doctype html> | |
<html> | |
<head> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function () { | |
$('#user-submit').click(function () { | |
var payload = { | |
name: $('#user-name').val() | |
}; | |
$.ajax({ | |
url: "/users", | |
type: "POST", | |
contentType: "application/json", | |
processData: false, | |
data: JSON.stringify(payload), | |
complete: function (data) { | |
$('#output').html(data.responseText); | |
} | |
}); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<h3>Entre o nome de um usuario que vai ser gravado no banco de dados MySQL:</h3> | |
<input id="user-name" type="text" /> | |
<input id="user-submit" type="submit" /> | |
<p id="output"></p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment