how to include tinymce in js

  html, javascript, laravel, tinymce

i need to include tinymce in this code.so when my client using the tabel to edit. the textarea show the tinymce for him not some html code

<script>
        $('body').on('keyup', '#search', function() {
            var searchQuesr = $(this).val();

            $.ajax({
                method: 'POST',
                url: '{{ route('products.search.edit') }}',
                dataType: 'json',
                data: {
                    '_token': $('meta[name="csrf-token"]').attr('content'),
                    searchQuesr: searchQuesr
                },
                success: function(res) {
                    var tableRow = '';

                    $('#ajaxbody').html('');

                    $.each(res, function(index, value) {
                        tableRow = '<tr><td><input type="checkbox" name="update[]" value="' +
                            value.id + '"></td><td><input type="text" name="name_' + value.id +
                            '" class="form-control" value="' + value.name +
                            '"></td><td><textarea type="text" class="form-control tinymce" required name="description_' +
                            value.id + '">' + value.description +
                            '</textarea></td><td><input type="text" name="meta_description_' +
                            value.id + '" id="meta_description" class="form-control" value="' +
                            value.meta_description +
                            '"></td><td><input type="text" name="price_' + value.id +
                            '" class="form-control" value="' + value.price +
                            '"></td><td><input type="text" name="special_' + value.id +
                            '" id="special" class="form-control" value="' + value.special +
                            '"></td><td><input type="text" name="stock_' + value.id +
                            '" class="form-control" value="' + value.stock +
                            '"></td><td><input type="number" name="ready_' + value.id +
                            '" id="ready" class="form-control" min="1" max="999" value="' +
                            value.ready + '"></td></tr>'+value.link+''

                        $('#ajaxbody').append(tableRow);
                    });
                }
            });
        });
    </script>

And this is my tinymce src im useing laravel

<script src="{{ asset('vendor/tinymce/js/tinymce/tinymce.min.js') }}"></script>

Source: Laravel

Leave a Reply