I've been checking summernote API, and there is my code
<form id="mail">
<input type="text" id="email">
<textarea id="summernote"></textarea>
<input type="submit">
</form>
$('#summernote').summernote({
placeholder: 'your Message',
tabsize: 2,
height: 300
});
$('document').ready(function() {
var messageData = $('#summernote').summernote('code');
var email = $('#email').val();
$(function() {
$('#mail').submit(function(event) {
event.preventDefault();
$.ajax({
url: 'sendmail.php',
type: 'post',
data: {
'send_mail': 1,
'to': email,
'message': messageData,
},
success: function(response) {
if (response == 'success') {
//my success response
} else if (response == 'error') {
//my error response
}
}
});
});
});
});
My problem is the message was successfully sent, but I didn't get that text area value, just an empty email. Please help.
Note: that I'm using phpMailer for sending email.
summernote
initialization is out of$(document).ready()..
; you are nesting$(function() {..
in$(document).ready..
which is not required. So remove that. And add yoursummernote
initializer code inside$(document).ready..
– Spectrochemistry