ここで、index.php で CKeditor を作成する方法を示します (CKfinder で使用しています)。
< textarea id="text" name="text" >
< /textarea >
<?php
include_once 'ckeditor/ckeditor.php';
require_once 'ckfinder/ckfinder.php' ;
$ckeditor = new CKEditor();
$ckeditor->basePath = 'ckeditor/' ;
CKFinder::SetupCKEditor( $ckeditor, 'ckfinder/' ) ;
$config['height'] = '300';
$ckeditor->editor('text', $initialValue, $config);
?>
このボタンを介してエディターの値を以下の ajax 関数に送信します。
( < a onclick="submit();" > Send < /a > == >
これは ajax 関数を完全に呼び出します)
function submit()
{
var textbox= CKEDITOR.instances.text.getData();
$.ajax({
type: "POST",
url: "index2.php",
data: "textbox="+textbox,
error: function(){
alert('Error while loading');
},
success: function(data){
$('#content').html(data);
}
});
}
index2.php で値を取得しようとしました
$textbox= $_POST['textbox'];
そしてそれはうまくいきませんでした。私もそれを経由して取得しようとしました
$textbox= stripslashes($_POST['textbox']) ;
$textbox=mysql_real_escape_string($textbox);
イットも機能しませんでした。この問題をどうしたらよいかわかりません。どんなアイデアでも大歓迎です