Ckeditor通過Ajax更新資料

來源:互聯網
上載者:User

標籤:head   des   屬性   edit   overflow   ext   split   article   end   

之前在表單中對ckeditor的賦值就直接是
     $("#theadEditor").val(result);
 而如今我想通過點擊不同選項來使用Ajax在後台訪問資料。對ckeditor賦值,可是頁面根本沒有變化,而背景資料卻有。

那麼如今肯定的就是ckeditor的問題了。 我認為應該是ckeditor已經建立了。而通過一般的賦值應該不行。那麼僅僅有先通過銷毀。再建立這種方式來處理了。以下是我在Stack Overflow中看到的一種解決方案。

$.post("你的訪問資料地址",{參數名:參數值},function(result){    var editor = CKEDITOR.instances["editorName"]; //你的編輯器的"name"屬性的值    if (editor) {             editor.destroy(true);//銷毀編輯器    }           CKEDITOR.replace(editorID); //替換編輯器,editorID為ckeditor的"id"屬性的值    $("#editorID").val(result);    //對editor賦值});
如今問題應該就攻克了。

Ckeditor通過Ajax更新資料

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.