我在Mozilla 工作非常出色。 但是它没有将文本保存到 Chrome 浏览器的数据库中。 我正从php 发送数据到$, ajax 方法。 这是 PHP 文件的代码 :
<div class="post_content"> Post Content <?
$sBasePath = $_SERVER[ PHP_SELF ] ;
$sBasePath = "fckeditor/";
$oFCKeditor = new FCKeditor( FCKeditor1 ) ;
$oFCKeditor->Height = 400 ;
$oFCKeditor->BasePath = $sBasePath ;
$oFCKeditor->Value = ;
$oFCKeditor->Create();
?>
</div>
这是我的笔记本:
$(document).ready(function(){
$("#add_new_post").submit(function() {
var FCKGetInstance = FCKeditorAPI.GetInstance( FCKeditor1 );
var getText = FCKGetInstance.EditorDocument.body.innerHTML;
var StripTag = getText.replace(/(<([^>]+)>)/ig,"");
var dataString = FCKeditor1= + getText;
if(StripTag== )
{
alert( Please enter Post Content . );
} else {
//alert(dataString);
$.ajax({
type: "POST",
url: "ajax_add_new_blog_post.php",
data: dataString,
cache: false,
success: function(html){
$("body").showMessage({
thisMessage : [html],
autoClose : true,
className : tooltip ,
delayTime : 8000,
displayNavigation : false
});
setTimeout(function() {
window.history.back();
}, 3000);
}
});
}
return false;
});
});
以下是我的ajax_add_ new_blog_pos.php 代码:
$pagedetail = RTESafe($_REQUEST[ FCKeditor1 ]);
$str="INSERT INTO posts set
post_text= ".mysql_real_escape_string($pagedetail)." ";
$success = mysql_query($str);
if($success){
echo You have added post successfully! ;
}else{
echo Adding post was not successful. Try again ;
}
function RTESafe($strText) {
$tmpString = trim($strText);
$tmpString = str_replace(chr(145), chr(39), $tmpString);
$tmpString = str_replace(chr(146), chr(39), $tmpString);
$tmpString = str_replace(" ", "'", $tmpString);
$tmpString = str_replace(chr(147), chr(34), $tmpString);
$tmpString = str_replace(chr(148), chr(34), $tmpString);
$tmpString = str_replace(chr(10), " ", $tmpString);
$tmpString = str_replace(chr(13), " ", $tmpString);
return $tmpString;
}