Skip to content

Instantly share code, notes, and snippets.

@benjaminreid
Created August 13, 2014 16:13
Show Gist options
  • Save benjaminreid/22a204728c80a64e4062 to your computer and use it in GitHub Desktop.
Save benjaminreid/22a204728c80a64e4062 to your computer and use it in GitHub Desktop.
var data, id, that, type, url;
that = this;
id = this.$el.attr('id');
url = this.$el.attr('action');
type = this.$el.attr('method');
data = this.$el.serialize();
$.ajax({
url: url,
type: type,
data: data
}).success(function(res) {
var updated_html;
updated_html = $('<div />').html(res).find("#" + id).html();
that.$el.html(updated_html);
}).error(function() {
console.log('error');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment