我正在將tinyMCE編輯器與正在使用Zend Framework進行開發的系統進行集成。tinymce getContent()在ajax中加載編輯器時返回空字符串
以下是爲TinyMCE的編輯代碼的局部視圖代碼
<script type="text/javascript" src="<?php echo $this->baseUrl()?>/js/tinymce/jquery.tinymce.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl()?>/js/jquery.validate.tinymce.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('textarea.editor').tinymce({
script_url : '<?php echo $this->baseUrl()?>/js/tinymce/tiny_mce.js',
// General options
theme : "advanced",
plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
// Theme options
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true
});
});
</script>
的問題是,當鑑於AJAX加載,調用提交按鈕的點擊事件之後:
var content = tinyMCE.get('body').getContent();
alert(content);
return是一個空字符串。如果視圖加載正常一切正常。這只是在FF。即使使用Ajax,Chrome和IE8也能正常工作。
有沒有人有過這方面的經驗?
編輯: 基本上我的應用程序是使用MVC結構。視圖是MVC的V部分。加載到瀏覽器的主頁是包含「添加新」按鈕的商品列表頁面。一旦點擊了一個新的視圖,通過ajax加載並添加到頁面。加載的視圖同時包含tinymce和textarea HTML的所有JavaScript代碼。它的所有工作,除了未在FF
你是什麼意味着觀點和阿賈克斯?請更準確的你做什麼描述小有一點位會發生什麼 – Thariama 2011-02-14 17:09:10