mandrill ajax调用在尝试发送电子邮件时返回错误

时间:2015-10-12 15:44:11

标签: javascript jquery ajax mandrill

当我尝试单击页面上的按钮时,发送电子邮件的预期结果似乎不起作用。

我确实在控制台中看到Uncaught SyntaxError: Unexpected token ILLEGAL,控制台错误指向的行是ajax方法的第一个属性,即帖子。

  btnSendEmail.click(function(){
    var fromEmail = txtEmail.val();
    var senderName = txtName.val();
    var toEmail = "someemail@floormind.com";
    var mandrillKey = "SOME API KEY";
    var emailContent = txtEnquiry.val();
    $.ajax({
      type: "POST",
      url: “https://mandrillapp.com/api/1.0/messages/send.json”,
      data: {
        ‘key’: mandrillKey,
        ‘message’: {
          ‘from_email’: fromEmail,
          ‘to’: [
              {
                ‘email’: toEmail,
                ‘name’: senderName,
                ‘type’: ‘to’
              }
            ],
          ‘autotext’: ‘true’,
          ‘subject’: ‘Enquiry’,
          ‘html’: ‘YOUR EMAIL CONTENT HERE! YOU CAN USE HTML!’
        }
      }
    }).done(function(response) {
      $('#modalSendEmail').modal('hide');
      console.log(response); // if you're into that sorta thing
    });
  });

0 个答案:

没有答案