Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用ajax将数据放入CKEditor字段_Javascript_Jquery_Ajax_Symfony3.x - Fatal编程技术网

Javascript 使用ajax将数据放入CKEditor字段

Javascript 使用ajax将数据放入CKEditor字段,javascript,jquery,ajax,symfony3.x,Javascript,Jquery,Ajax,Symfony3.x,我有一个修改项目中实体的模式。当我将数据放入模式时,只有CKeditor字段为空 我已经测试了不同的解决方案,但到目前为止没有一个有效。我检查了,我想放在CKEditor字段中的数据不是空的或不存在的 谢谢你的帮助 阿贾克斯: function ($) { function remplirFormSociete(modal,reponse){ alert(reponse['INFO']); modal.find('input#edit_form_Id').val(

我有一个修改项目中实体的模式。当我将数据放入模式时,只有CKeditor字段为空

我已经测试了不同的解决方案,但到目前为止没有一个有效。我检查了,我想放在CKEditor字段中的数据不是空的或不存在的

谢谢你的帮助

阿贾克斯:

function ($) {
function remplirFormSociete(modal,reponse){
    alert(reponse['INFO']);
            modal.find('input#edit_form_Id').val(reponse['Id']);
            modal.find('input#edit_form_NOM').val(reponse['NOM']);
            modal.find('select#edit_form_CATEGORIES').val(reponse['CATEGORIES']);
            modal.find('input#edit_form_INFO').val(reponse['INFO']);
            modal.find('input#edit_form_HOST').val(reponse['HOST']);
            modal.find('input#edit_form_NOM_USER').val(reponse['NOM_USER']);
            modal.find('input#edit_form_MDP').val(reponse['MDP']);
    }

    $(document).ready(function(){  

        //Lorsque l'utilisateur édit un employé temporaire
        $('#EditSociete').on('show.bs.modal', function (event) {
            var button = $(event.relatedTarget) // Button that triggered the modal
            var recipient = button.data('whatever') // Extract info from data-* attributes
            var modal = $(this);
            if(recipient){
                $.ajax({
                    url: BaseURL+"/societe/ajax/Societe",
                    method: "post",
                    data: {Id:recipient},
                    success :  function(reponse)  {
                        remplirFormSociete(modal,reponse[recipient]);
                     }
                });
            } else {
                var reponse = [];reponse['Id']='';reponse['CATEGORIES']='';reponse['INFO']='';reponse['HOST']='';reponse['NOM_USER']='';reponse['MDP']='';
                remplirFormSociete(modal,reponse);
            }
        });
    }); 
}) (jQuery);
形式如下:

 ->add('INFO',           CKEditorType::class, array('attr'       => array('class' => "form-control"),
                                                            'label'             => 'Information :',
                                                            'required'          => false,
                                                            'label_attr'        => array('class' => 'col-md-2 control-label')))

我认为这将解决您的问题:

CKEDITOR.instances.editor1.setData( '<p>This is the editor data.</p>' );
CKEDITOR.instances.editor1.setData(“这是编辑器数据。

”);

我认为这将解决您的问题:

CKEDITOR.instances.editor1.setData( '<p>This is the editor data.</p>' );
CKEDITOR.instances.editor1.setData(“这是编辑器数据。

”);

好的,我会试试。虽然这个链接可以解决这个问题,但只有在SOI上才不鼓励使用链接。我看不出有任何阻止链接的意义。现在真的没什么关系:(链接会随着时间的推移消失,使这个答案变得无关紧要。好吧,我认为不要在我的答案中添加链接。另一方面,如果有人针对我的问题提出另一个解决方案,我是买家;)好的,我会尝试。虽然这个链接可以解决问题,仅在SOI上不鼓励链接。我认为不鼓励链接没有任何意义。现在真的不重要了:(链接可能会随着时间的推移而消失,使这个答案变得无关紧要。好吧,我认为不要在我的答案中添加链接。另一方面,如果一个人为我的问题找到了另一个解决方案,我就是一个买家;)