Javascript 从外部文件设置tinymce的内容
如何在TinyMCE编辑器中加载特定的html模板? 我看到了这个代码,但它在我身上不起作用Javascript 从外部文件设置tinymce的内容,javascript,jquery,tinymce,Javascript,Jquery,Tinymce,如何在TinyMCE编辑器中加载特定的html模板? 我看到了这个代码,但它在我身上不起作用 $.get(“hello.html”,tinyMCE.activeEditor.setContent) 然后我尝试了这个代码,这样它会自动加载 $(window).load(function(){ $.get("../../../../app/views/tools/prooftemplate.phtml", tinyMCE.activeEditor.setContent); }); 但是它不
$.get(“hello.html”,tinyMCE.activeEditor.setContent)
然后我尝试了这个代码,这样它会自动加载
$(window).load(function(){
$.get("../../../../app/views/tools/prooftemplate.phtml", tinyMCE.activeEditor.setContent);
});
但是它不起作用。试试这个:-
您需要将数据传递给回调函数,然后像我所做的那样在函数中使用该数据。然后,文件中的数据被传递到“d”,所以我们用新加载的数据更新tinyMCE
$(window).load(function(){
$.get("../../../../app/views/tools/prooftemplate.phtml", function(d){
tinyMCE.activeEditor.setContent(d);
});
});
它说加载资源失败:服务器响应状态为404(未找到),但我非常确定文件的位置。谢谢你的回复。