Reputation: 1472
I've got this weird problem with my TinyMCE. I've made a FORM with the tinyMCE editor, no errors returned, works fine. But, when i make an ajax call, inserting some text into the database the text won't be placed in the database. However, if i click the button twice, the first row get's inserted without the text, and the second WITH the text.
Dose any one know why this happens? or have experience with it? maybe it's 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;
});
Upvotes: 3
Views: 1083
Reputation: 3183
Hard to really determine what is happening as there are too many variables involved. What I like to do is setup alert(); with friendly messages and try to track down the problem. In your case I would do that before ajax call is made and after and then work my way up to when the form is about to be submitted. You want to use alert to check if the data actually exists when the form is about to be submitted
Upvotes: 3