Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function () {
- $("#personCreate").click(function () {
- var person = getPerson();
- // poor man's validation
- if (person == null) {
- alert("Specify a name please!");
- return;
- }
- // take the data and post it via json
- $.post("home/save", person, function (data) {
- // get the result and do some magic with it
- var message = data.Message;
- $("#resultMessage").html(message);
- });
- });
- });
- function getPerson() {
- var name = $("#Name").val();
- var age = $("#Age").val();
- // poor man's validation
- return (name == "") ? null : { Name: name, Age: age };
- }
Add Comment
Please, Sign In to add comment