skip to Main Content

I am using ckeditor in laravel 8. But can not show data in ckeditor From Ajax.
Here is my Ajax Code.

 $('.edit').on('click', function() {
                var id = $(this).data('id');
                $.ajax({
                    type: "POST",
                    url: 'support-ticket-by-id',
                    data: {
                        id: id
                    },
                    dataType: 'json',

                    success: function(res) {
                        console.log(res);
                        $('#ajaxModelTitle').html("Edit");
                        $('#edit-modal').modal('show');
                        $('#id').val(res.id);
                        $('#edit_support_ticket_department_id').val(res
                            .support_ticket_department_id);
                        $('#edit_support_ticket_employee_id').val(res
                            .support_ticket_employee_id);
                        $('#support_ticket_priority').val(res.support_ticket_priority);
                        $('#support_ticket_subject').val(res.support_ticket_subject);
                        $('#support_ticket_note').val(res.support_ticket_note);
                        $('#support_ticket_date').val(res.support_ticket_date);
                        // $('#edit_support_ticket_desc').val(res.support_ticket_desc);
                        $('#support_ticket_status').val(res.support_ticket_status);
                    }
                });
            });

[Ajax Response](https://i.stack.imgur.com/UtNwr.jpg)
Ajax Response

I want to show

support_ticket_desc

value in CkEditor.
Note: I used CkEditor in textarea html tag.
Thanks.

2

Answers


  1. CKEDITOR.instances[‘edit_support_ticket_desc’].setData(res.support_ticket_desc)

    Login or Signup to reply.
  2. <!-- This is working for me -->
    
    $(document).on('click','.editbtn',function(){
            $('#cate_image').empty();
                var cate_id = $(this).val();
                $.ajax({
                   type:"GET",
                   url:"{{url('admin/category/edit')}}"+'/'+cate_id,
                   dataType:'json',
                   success:function(res){
                     $('#name').val(res.name);
                     $('#slug').val(res.slug);
                     $('#cate_image').append('<img src="{{URL::asset('')}}'+'/'+res.image+'" height="150px" width="200px">');
                     $('#ci_alt').val(res.image_alt_name);
                     $('#sort_order').val(res.sort_order);
                     $('#meta_title').val(res.meta_title);
                     $('#meta_description').val(res.meta_description);
                     CKEDITOR.instances['description'].setData(res.description); 
               CKEDITOR.instances['custom_script_code'].setData(res.custom_script_code); 
        CKEDITOR.instances['facebook_pixel_code'].setData(res.facebook_pixel_code);
        CKEDITOR.instances['google_analytics'].setData(res.google_analytics);                 
                   }
                });
             });
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search