本文介绍了如何ajax提交来自CKEditor的表单textarea输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 CKEditor、jQuery 和 jQuery 表单插件,我想提交通过 Ajax 查询生成 CkEditor 表单.这是我的代码:
I am using CKEditor, jQuery and jQuery form plugin and I would like to submit contents of the CkEditor form via an Ajax query. Here is my code:
<form id="article-form" name="article-form" method="post" action="/myproject/save">
<textarea name="bodyText" style="visibility: hidden; display: none;"></textarea>
<script type="text/javascript">
CKEDITOR.replace('bodyText');
</script>
<a onClick="$("#article-form").ajaxSubmit();">Submit</a>
</form>
很遗憾,Ajax 请求似乎没有传递bodyText
参数;
Unfortunately, it seems that the Ajax request does not pass the bodyText
parameter;
我做错了什么或者我怎样才能达到我所需要的?
What did I do wrong or how can I achieve what I need?
谢谢.
推荐答案
你需要先调用下面的,让CKEDITORs更新他们的相关字段..
you need to first call the following, to make the CKEDITORs update their related fields..
for ( instance in CKEDITOR.instances )
CKEDITOR.instances[instance].updateElement();
所以
HTML
<a onClick="CKupdate();$('#article-form').ajaxSubmit();">Submit</a>
和 JavaScript
and javascript
function CKupdate(){
for ( instance in CKEDITOR.instances )
CKEDITOR.instances[instance].updateElement();
}
这篇关于如何ajax提交来自CKEditor的表单textarea输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!