jquery ajax call html newsletter mess up
My problem is when I trying to testsend html newsletter via ajax. The html newsletter email content become not properly formatted.
The original html newsletter content to push over to ajaxcall.php consist of html tags, css etc..
$.ajax({
开发者_如何学Pythonurl: "ajaxcall.php",
type: "POST",
data: 'toEmail=' + $("#toemail").val() + '&Subject=' + $("input[name='subject']").val() + '&Body=' + body,
timeout: 8000,
beforeSend: function(){ },
...
...
I believe need to do some encoding decoding or striping? utf? at ajax sending side and at ajaxcall.php side?
jQuery will do it for you if you don't try to construct the encoded data manually.
data: {
toEmail: $("#toemail").val(),
Subject: $("input[name='subject']").val(),
Body: body
}
Or just tell it to deal with a form:
data: $('form#myForm').serialize()
精彩评论