0

i'm using tinymce as a text editor in my program, so after adding the data in the form and trying to save it with AJAX, all of the fields are saved normally, except the textarea with tinymce editor, here's my code, my issue is with (content) textarea:

<script type="text/javascript">
tinymce.init({
selector: "textarea#content",
 theme: "modern",
plugins: [
     "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker",
     "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
     "save table contextmenu directionality emoticons template paste textcolor"
],
content_css: "css/content.css",
toolbar: "link image | fontselect fontsizeselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | print preview media fullpage | forecolor backcolor emoticons"
});
  </script>

<script type="text/javascript">
$(document).ready(function(){


 $('#submit').click(function(){  
$('#result').fadeOut("fast");
$('#wait').fadeIn("slow").delay(1000);
    var title = $("input#title").val();
    var content = $("textarea#content").val();
    var student_year = $("select#student_year").val();
    var student_group = $("select#student_group").val();

    var direction = $("input#direction").val();

  var dataAll = { title:title,
  content:content,
  student_year:student_year,
  student_group:student_group
      } 
  $.ajax({
    url: direction,
    type : "POST",
    data : dataAll,
    dataType :"html",
    success : function(msg){
        $('#wait').fadeOut("fast");
        $('#result').fadeIn("slow");
         $('#result').html(msg)

    }

  });

});

});
</script>  

1 Answer 1

1

Please try adding this line following $('#submit').click(function(){:

tinymce.triggerSave();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.