开发者

jquery ajax call html newsletter mess up

开发者 https://www.devze.com 2023-02-14 15:13 出处:网络
My problem is when I trying to testsend html newsletter via ajax. The html newsletter email content become not properly formatted.

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()
0

精彩评论

暂无评论...
验证码 换一张
取 消