亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

JQuery.Ajax() 無法正常工作不確定腳本是否正確加載

JQuery.Ajax() 無法正常工作不確定腳本是否正確加載

慕工程0101907 2023-09-14 18:12:48
我正在嘗試使用 API 通過 MailChimp 發送電子郵件。通過這樣做,我可以避免使用任何類型的后端。我不知道我的 Jquery 腳本文件設置是否錯誤。$(document.ready(function () {  $('#survey').click(function() {    $.ajax({        type: “POST”,        url: “https://mandrillapp.com/api/1.0/messages/send.json”,        data: {          ‘key’: ‘api Key’,          ‘message’: {            ‘from_email’: ‘email’,            ‘to’: [                {                  ‘email’: ‘email’,                  ‘name’: ‘RECIPIENT NAME (OPTIONAL)’,                  ‘type’: ‘to’                }              ],            ‘autotext’: ‘true’,            ‘subject’: ‘Class Survey’,            ‘html’: ‘Here is your survey link: <a>link</a>’          }        }       }).done(function(response) {         console.log(response);     });  });}); 以下是我在 VS Code 中收到的所有錯誤我不知道為什么 VS Code 會突出顯示所有代碼。我還想提一下控制臺給出了這個錯誤,即使它沒有提供太多信息。Uncaught SyntaxError: Invalid or unexpected token謝謝您的幫助!
查看完整描述

1 回答

?
千萬里不及你

TA貢獻1784條經驗 獲得超9個贊

這是因為您使用了錯誤的雙引號

用這個"代替這個

用這個'代替

  $(document).ready(function() {

        $('#survey').click(function() {

            $.ajax({

                type: "POST",

                url: "https://mandrillapp.com/api/1.0/messages/send.json",

                data: {

                    'key': 'api Key',

                    'message': {

                        'from_email': 'email',

                        'to': [

                            {

                            'email': 'email',

                            'name': 'RECIPIENT NAME (OPTIONAL)',

                            'type': 'to'

                            }

                        ],

                        'autotext': 'true',

                        'subject': 'Class Survey',

                        'html': 'Here is your survey link: <a>link</a>'

                    }

                }

            }).done(function(response) {

                console.log(response); 

            });

        });

    });


查看完整回答
反對 回復 2023-09-14
  • 1 回答
  • 0 關注
  • 101 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號