Skip to content

Instantly share code, notes, and snippets.

@yosemitebandit
Created April 30, 2012 17:46
Show Gist options
  • Save yosemitebandit/2560411 to your computer and use it in GitHub Desktop.
Save yosemitebandit/2560411 to your computer and use it in GitHub Desktop.
a (failed) shot at jqeditable; didn't have all the callbacks I wanted
$(function() {
// drop the ajax-ed-ness..it's just not working out
// save the below in a gist
$('.edit').editable(function(value, settings) {
// gather up the user data
var form_data = {
_csrf_token: '{{ csrf_token() }}'
};
var key = $(this).attr('data-id');
form_data[key] = value;
// send to url
$.ajax({
type: 'post'
, url: '{{ url_for("profile") }}'
, data: form_data
, success: function(data) {
console.log('yay')
console.log(data);
}
, error: function(data) {
console.log('boo')
console.log(data);
}
});
// modify button
return value
}, {
submit: '<button type="submit" class="btn btn-primary edit-in-place-save">Save</button>'
, onerror: function() {
console.log('balls');
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment