Using CKed in a PHP page loaded with AJAX
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
[...]
function loadXMLedition(lk)
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttpedition=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttpedition=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttpedition.onreadystatechange=function()
{
if (xmlhttpedition.readyState==4 && xmlhttpedition.status==200)
{
document.getElementById("divaffichage04edition").innerHTML=xmlhttpedition.responseText;
}
else
{
document.getElementById("divaffichage04edition").innerHTML="Erreur";
}
}
xmlhttpedition.open("GET","ajax/fileparameter.php?lk="+lk,true);
xmlhttpedition.send();
} </script>
[...]
<a href="javascript:loadXMLedition("aparameter")">blbakba</a>
[...]
<div id="divaffichage04edition">
</div>
<?php
[...]
?>
<form action="index.php?page=97&id=04_edition" method="post" name="affichage">
<p><textarea name="showdata2edit">
Hello world
</textarea><script type="text/javascript">CKEDITOR.replace( 'showdata2edit' );</script></p>
<input type="submit" value="Modifier">
<input type="hidden" value="eemlkr">
</form>
<?
}
else
{
echo 'Choix invalide '.htmlspecialchars(addslashes($lk));
}
?>
<html>
<head>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
</head>
<body>
<?php
[...]
?>
<form action="index.php?page=97&id=04_edition" method="post" name="affichage">
<p><textarea name="showdata2edit">
Hello World
</textarea><script type="text/javascript">CKEDITOR.replace( 'showdata2edit' );</script></p>
<input type="submit" value="Modifier">
<input type="hidden" value="ere">
</form>
<?
}
else
{
echo 'Choix invalide '.htmlspecialchars(addslashes($lk));
}
?> </body></html>
Re: Using CKed in a PHP page loaded with AJAX
Re: Using CKed in a PHP page loaded with AJAX
What you must do is to create an ajax stop event that triggers instantiating CKEditor once the ajax request has successfully completed.
Avoid using the CKEditor API to do the actual ajaxing if you can. It's very poor for that. No sync switch and a too short time out.
Thanks,
Zanpakutō
Re: Using CKed in a PHP page loaded with AJAX
xmlhttpedition.onreadystatechange=function() { if (xmlhttpedition.readyState==4 && xmlhttpedition.status==200) { document.getElementById("divaffichage04edition").innerHTML=xmlhttpedition.responseText; CKeditor.replace( 'showdata2edit' ); } else { document.getElementById("divaffichage04edition").innerHTML="Erreur"; } }Re: Using CKed in a PHP page loaded with AJAX