JQuery TinyMCE not working on AJAX

I have this strange problem with my TinyMCE. I created FORM with tinyMCE editor, no errors returned, it works fine. But, when I make an ajax call, inserting some text into the database, the text will not be placed in the database. However, if I press the button twice, the first line is inserted without text, and the second with text.

Enough to know why this is happening? or have experience with it? maybe this is a common problem?

$('#newsWrite').submit(function() {

    var testing = $('#newsWrite').serialize();

    alert(testing);

    $('#box_load').show();
    $('#box_error').html('');
    $('#box_ok').html('');

    $.post('js/ajax/writeNews.php', $('#newsWrite').serialize(), function(data) {
        alert(testing);
        $('#box_load').hide();

        if(data.error == 'false') {
            $('#box_ok').append(data.errorMessage);
            $('#box_ok').fadeIn();
        }

        if(data.error == 'true') {
            $('#box_error').append(data.errorMessage);
            $('#box_error').fadeIn();
        }

    },'json');

    return false;

});  
+3
source share
1 answer

, , . alert(); . , ajax- , , . , , , ​​

+3

All Articles