I am not really good in jquery/ajax. How do I save the value of var message
into the database? Because what im trying to do is to save files into the database which is working but the message doesn't show. I think the problem is that there's no data to fetch in my message but I don't know how to do that..
$('.submit').click(function(){
var name = '<?php echo $row['name'];?>';
var message = $('.message').val();
if (message.length>1) {
$.ajax({
url:'answer.php?id=<?php echo $id;?>',
data: new FormData($('.form')[0]),
type:'post',
cache: false,
contentType: false,
processData: false,
success:function(){
$('.message').val('');
listComments();
alert('Post Message');
}
})
} else {
alert('PLEASE DO RIGHT A MESSAGE BEFORE SENDING');
}
});