Created
April 30, 2012 17:46
-
-
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
This file contains hidden or 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
$(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