Hello,
this post comes from a French topic :
Ajax pour sauvegarder.
Summary : I want to save the document with Ajax in the case I want to continue edition.
I have an approximative solution, which does not work with FCKEditor and does not well handle special charactere :
In content_mutate_dynamic I put
function masave(){
if(document.mutate.stay[1].checked){
ggg=Form.serialize(document.mutate);
ggg+="&ajax=true";
ggg=ggg.replace(/\%C3\%A0/gi,escape("à"));
ggg=ggg.replace(/\%C3\%A9/gi,escape("é"));
ggg=ggg.replace(/\%C3\%A8/gi,escape("è"));
ggg=ggg.replace(/\%C3\%B9/gi,escape("ù"));
ggg=ggg.replace(/\%C3\%A2/gi,escape("â"));
ggg=ggg.replace(/\%C3\%AA/gi,escape("ê"));
ggg=ggg.replace(/\%C3\%BB/gi,escape("û"));
var myAjax=new Ajax.Updater("motmpid","index.php",{ method: 'post', parameters: ggg});}
else document.mutate.save.click();
}
which uses prototype.js.
Then I call "masave()" with "Button1" of the form
mutate.
Just before the form, I put
Now I turn my attention to the file save_content.processor.
At the top I place
$ajax=false;
if(isset($_POST['ajax']) && $_POST['ajax']=='true') $ajax=true;
then I use the variable $ajax at the end of the treatment :
if($ajax){echo "Save done at ".date("H:i:s");exit;}
header($header);
break;
default:
header("Location: index.php?a=7");
exit;