Varun Sridharan
Varun Sridharan

Reputation: 1978

Save Data fromTinyMCE to php using ajax

I am using TinyMCE in my application

i want to save the data entered in TinyMCE using ajax to php

I have tried using tinyMCE.triggerSave() before send to ajax but when some emoticons | images are added i get the out put as [img] link for image [/img] done this html regnosie this type of coding when output as html in browser ?

how i can save the data as a html to db

My Script

tinymce.init({
    selector:'textarea#chat_message',
    theme: "modern",
    menubar: false,
    width:900,
    height:100,
    statusbar: false,
    plugins: [
        "save advlist autolink lists link image charmap print preview anchor",
        "searchreplace spellchecker visualblocks code fullscreen",
        "insertdatetime media table contextmenu paste emoticons bbcode  anchor lists"
    ],
    toolbar:" save bold italic | bullist numlist outdent indent | autolink | link | image | lists | charmap | anchor | spellchecker | wordcount visualblocks | visualchars | table | directionality | emoticons | paste |  spellchecker | bbcode | code |",
entity_encoding: 'raw'
});

Upvotes: 1

Views: 72

Answers (1)

Sark
Sark

Reputation: 4546

$("#chat_message").html() will give you the actual content ( without stripping html tags ).

Upvotes: 1

Related Questions