【发布时间】:2016-11-14 19:41:52
【问题描述】:
我在一页上使用“tinyMCE”作为动态。
所以我必须使用“setContent”来更改“tinyMCE”中的内容。
但是,我不知道如何在 ajax 或 go ajax 之前检查 is_file(在 PHP 检查文件是否存在)。
请告诉我~
$(".editor-button").bind("click", function(){
var title, file;
title = $(this).data("title");
$(".ui-dialog-title").text(title);
switch (match_arr[title]) {
case 1:
file = "../../front/footer/about_us.html";
break;
case 2:
file = "../../front/footer/return_policy.html";
break;
default:
}
$.ajax({
url : file,
dataType: "html",
success : function (html){
html != "" ? tinyMCE.get('text-box').setContent(html) : tinyMCE.get('text-box').setContent('');
}
});
$("#text-editor-dialog").dialog("open");
});
【问题讨论】: