I have this script:
$.ajax({
url: 'submit_to_db.php',
type: 'POST',
data: 'name=' + name + '&email=' + email + '&comments=' + comments,
success: function(result) {
$('#response').remove();
$('#container').append('<p id="response">' + result + '</p>');
$('#loading').fadeOut(500, function() {
$(this).remove();
});
}
});
Then in my php file, after insert to database, I echo "comment updated", then append to my container and slowly fade away. In the meantime, I want to insert the new comment into the container as well. So I tried echo "comment updated!&com=".$comment; but it was returned as string rather than 2 variables. \
EDIT:
So weird, i am getting undefined in my php file,
$comment = $_POST['comment']
is there something wrong in my js or php code?