I'm working on a CMS and had the idea of doing on-page altering. The problem is, it takes two submits to get the data to submit, or even show up on the page. Could anyone help? :]
Here's the code.
Here's the code.
Code:
function toggleEditor(id) {
if (!tinyMCE.get(id)){
tinyMCE.execCommand('mceAddControl', true, id);
} else {
tinyMCE.execCommand('mceRemoveControl', false, id);
}
}
$(document).ready(function()
{
$("#editInPlace").editable({type:'textarea',onEdit:begin,submit:'save',onSubmit:end});
function begin()
{
toggleEditor('mcecontent');
}
function end()
{
var page_content = $("#editInPlace").html();
var page_name = document.getElementById('pages_page_name').innerHTML;
$.ajax({
type: "POST",
url: "testing.php",
data: "content=" + page_content + "&pagename=" + page_name,
success : function(Data){
}
});
}
});