【问题标题】:jquery ajax call html newsletter mess upjquery ajax 调用 html 时事通讯搞砸了
【发布时间】:2011-07-08 16:35:24
【问题描述】:

我的问题是当我尝试通过 ajax 测试发送 html 时事通讯时。 html 时事通讯电子邮件内容的格式不正确。

要推送到 ajaxcall.php 的原始 html 时事通讯内容由 html 标签、css 等组成。

$.ajax({

    url: "ajaxcall.php",
    type: "POST",                       
    data: 'toEmail=' + $("#toemail").val() + '&Subject=' + $("input[name='subject']").val() + '&Body=' + body,
    timeout: 8000,             
    beforeSend: function(){ },

...
...

我认为需要进行一些编码解码或条带化? utf?在ajax发送端和ajaxcall.php端?

【问题讨论】:

    标签: jquery html ajax newsletter


    【解决方案1】:

    如果您不尝试手动构建编码数据,jQuery 会为您完成。

    data: {
        toEmail: $("#toemail").val(),
        Subject: $("input[name='subject']").val(),
        Body:  body
    }
    

    或者只是告诉它处理一个表单:

    data: $('form#myForm').serialize()
    

    【讨论】:

      猜你喜欢
      • 2016-12-11
      • 1970-01-01
      • 1970-01-01
      • 2011-08-17
      • 2010-09-05
      • 1970-01-01
      • 1970-01-01
      • 2012-09-20
      相关资源
      最近更新 更多