Skip to content

Instantly share code, notes, and snippets.

@atuttle
Created June 9, 2010 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atuttle/432050 to your computer and use it in GitHub Desktop.
Save atuttle/432050 to your computer and use it in GitHub Desktop.
//update-form handler
$("##update").submit(function(e){
e.preventDefault();
var frm = $(this);
$.ajax({
url: frm.attr('action'),
data:{
firstname: $("##update input[name=firstname]").val(),
lastname: $("##update input[name=lastname]").val(),
address: $("##update input[name=address]").val(),
city: $("##update input[name=city]").val(),
state: $("##update input[name=state]").val(),
postalcode: $("##update input[name=postalcode]").val(),
email: $("##update input[name=email]").val(),
phone: $("##update input[name=phone]").val(),
fax: $("##update input[name=fax]").val(),
thepassword: $("##update input[name=thepassword]").val()
},
type: frm.attr('method'),
dataType: "json",
contentType: "application/json",
success: function (data, textStatus, xhr){
console.log(data);
reloadData();
},
error: function (xhr, textStatus, err){
console.log(textStatus);
console.log(err);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment