0
我有一个电子邮件系统,我正在为他们想发送邮件的公司建立一个电子邮件系统。我有一个自定义的HTML编辑器。我想要做的是将内容发布到外部PHP文件并将其添加到数据库中。AJAX与HTML?
function schedule_eblast (html) {
var answer = confirm("Are you sure you want to start sending this E-blast?");
if (answer) {
$.ajax({
type: "POST",
url: "./../../../processes/eblast_schedule.php",
data: {'html_text': html},
success: function(theRetrievedData) {
if (theRetrievedData == "done") {
alert("Your eblast has been successfully scheduled to send. To check it's status, go to the manage eblasts page.");
} else {
alert(theRetrievedData);
}
}
});
return false;
}
这里是我在eblast_schedule.php文件的标题:
<?php
include('connect.php');
if ((isset($_POST['html_text'])) && (strlen(trim($_POST['html_text'])) > 0)) {
$html_text = stripslashes(strip_tags($_POST['html_text']));
} else {
$html_text = "";
}
if ((isset($_POST['subject'])) && (strlen(trim($_POST['subject'])) > 0)) {
$subject = stripslashes(strip_tags($_POST['subject']));
} else {
$subject = "";
}
ob_start();
是的,它被调用。但是当输出html_text
时,它会删除所有的HTML。当添加到数据库时,它也不会显示HTML。
帮助!谢谢。
怎么会显示HTML当你'trim','stripslashes','strip_tags'呢? –
脑屁......你不知道我现在有多愚蠢。感谢您指出!也许我需要更多的睡眠... – iosfreak
什么是睡眠:)?请在下面检查我的答案... –