0

So I have the editor mostly setup for inlineMode.

Here's what my implementation code currently looks like:

<article class="post editable" data-save-id="post-mission_statement">

$('.editable').editable({
    inlineMode: true,
    saveURL: 'http://www.unicon.church/admin/save.php',    
    saveRequestType: 'POST',
    autosave: true,
    autosaveInterval: 2500
});
$(".editable").on('editable.beforeSave', function (e, editor, data) {
    // HOW THE HECK do I figure out what the data-save-id is?!?!
    console.log(e);
    // I want to do 
    // editor.option('saveParams', { postId: $(parentDiv).data('saveId') });
    // but due to lack of examples and proper documentation, I don't even know if that is right.
});

How do I pass the context of the edit box (the post-mission_statement) to Froala and then to the AJAX request, so PHP can figure out the proper primary key to store the data?

4

1 回答 1

1

$(this).data('save-id')就是你要找的。this包含要在其上添加事件的 DOM 元素。

于 2014-11-28T16:37:04.407 回答