TypeError:_jquery2.default.get不是函数

我正尝试使用jquery $ .get()方法从服务器发送电子邮件,但我不断收到此错误: TypeError:_jquery2.default.get不是函数

这是我的alert.js文件

import $ from 'jquery';

export const sendAlertEmail = (arrayToEmail,to,subject) => {
    return new Promise( async (resolve,reject) => {
        try{
                var text =
                                `<div width="100%",style="text-align:left;">` +
                                `<h1 style="text-align:center;">Kiosks With Reoccuring Issues</h1>` +
                                `<table border="1",width="100%">` +
                                `<tbody style="text-align:left;">` +
                                `<tr><td width="300">Kiosk(s) that have had 2 or more issues within the last 30 days. Please monitor them closely.</td></tr>` +
                                arrayToEmail + 
                                `</tbody>` +
                                `</table >` +
                                `</div >`;

            $.get("/send",{ to: to,subject: subject,text: text },function (data) { });
            reject(false);
        } catch(e){
            console.log("ERROR: There was an error sending this email")
            reject(e);
        }
    })
}

这是我的routing.js文件的一部分


module.exports function(server,io){
 return function(req,res,next){
server.post('/api/alert-notifications',bodyParser.urlencoded({extended: false}),async (req,res) => {
            console.log(req.body);
            try{
                let arrayToEmail = req.body.arrayToEmail;
                let to = req.body.to;
                let subject = req.body.subject;
                let text = req.body.text;

                let results = await sendAlertEmail(arrayToEmail,subject,text);
                console.log(results);
                return res.status(200).send("emailed successful");
            }catch(e){
                return res.status(400).send("something broke: " + e);
            }
        });

 }

}

我对诺言的运作方式不满意,所以也许我在其中也做错了事,但我不确定。如果有人可以给我一些建议或知道问题出在哪里,我将不胜感激!谢谢。

cj1987fdsgsg 回答:TypeError:_jquery2.default.get不是函数

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2794925.html

大家都在问