submitting via ajax post.
Added by Tom Shafer 4 months ago
I am trying to save using ajax but I cant seem to grab the id to grab the content to save it. I am using multiple instances which are opened in a jquery ui dialog box.
$('.edit_area').click(function() { // open dialog on click
data = $(this).html();
var dialog = $('<div/>').dialog({
title : 'Panel Editor',
width : 600
});
// create element for elRTE
var rteInDialog = $('<div>'+data+'</div>');
// put element inside dialog
dialog.append(rteInDialog);
// create elRTE on element
rteInDialog.elrte(opts);
$('.el-rte').css('width','600px');
The problem comes when I try to save it.
elRTE.prototype.ui.prototype.buttons.save = function(rte, name) {
this.constructor.prototype.constructor.call(this, rte, name);
this.active = true;
this.command = function() {
//this.rte.save();
var panel = $(this).elrte('val');
$.ajax({
type: "POST",
url: "ajax.php",
data: 'edit=1&panel=' + panel,
cache: false,
});
}
this.update = function() { }
}
How can I grab the id of the div from where the editor pulled the data from and then how do I grab the content from the editor.
Thanks
Replies (1)
RE: submitting via ajax post.
-
Added by Troex Nevelin 4 months ago
Try button.closest('.el-rte').prev() - if you created elRTE on div
or
button.closest('.el-rte').find('textarea') - if on textarea
button - probably will be this in your example
(1-1/1)