Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Internet explorer 如何仅从客户端使用mandrillappapi?_Internet Explorer_Cross Browser_Cross Domain_Mailchimp_Mandrill - Fatal编程技术网

Internet explorer 如何仅从客户端使用mandrillappapi?

Internet explorer 如何仅从客户端使用mandrillappapi?,internet-explorer,cross-browser,cross-domain,mailchimp,mandrill,Internet Explorer,Cross Browser,Cross Domain,Mailchimp,Mandrill,我最近开始使用Mandrill发送客户端电子邮件。客户端网站不使用任何服务器端程序,因此每个逻辑都必须在客户端 我现在用的是Chrome、FireFox、IE10,但不是LTE IE9,也不是Android

我最近开始使用Mandrill发送客户端电子邮件。客户端网站不使用任何服务器端程序,因此每个逻辑都必须在客户端

我现在用的是Chrome、FireFox、IE10,但不是LTE IE9,也不是Android<4.0,也不是IOS:\

m = new mandrill.Mandrill("APIKEY", true)
m.call "messages/send", {
    message:
        html: createHtml()
        subject: "subj"
        from_email: "sender@example.dk",
        from_name: "From",
        to: [
            email: "user@example.com"
            name: "User"
        ]
}, (()->
    console.log "success"
    @
), ()->
    console.log "error"
    @
在这段代码中,我使用了,但是我用jQueryAjax POST-ing尝试了它,得到了相同的结果

jQuery版本:

$.ajax
    type: "POST"
    url: "https://mandrillapp.com/api/1.0/messages/send.json"
    data:
        key: "APIKEY"
        message:
            html: createHtml()
            subject: "subject"
            from_email: "sender@example.dk",
            from_name: "From",
            to: [
                email: "user@example.com"
                name: "User"
            ]

有谁能帮我解决一下,如何修复对Mandrill的跨域API调用?

您的代码似乎有效,因此可能遇到了浏览器兼容性问题


Mandrill API包装器在后台使用本机
XMLHttpRequest
,因此可能与旧浏览器不兼容。如果您需要支持IEThanks,我会在回家后检查:)顺便说一句,我使用jQuery 1.10.2,所以这应该不会是一个问题。使用Mandrill,您可以指定允许发送电子邮件的IP地址,因此“黑客”只能从同一个站点使用它