获取错误ReferenceError:未定义“ $”。当以下功能运行时。我已经在Google API控制台和高级Google Services中启用了Sheets API。
function createTriggers2() {
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>;
var settings = {
"async": true,
"crossDomain": true,
"url": "http://api.msg91.com/api/v2/sendsms",
"method": "POST",
"headers": {
"authkey": "My_auth_key",
"content-type": "application/json"
},
"processData": false,
"data": "{ \"sender\": \"SOCKET\", \"route\": \"4\", \"country\": \"91\", \"sms\": [ { \"message\": \"Message1\", \"to\": [ \"96xxxxx\", \"70xxxxx\" ] }, { \"message\": \"Message2\", \"to\": [ \"98260XXXXX\", \"98261XXXXX\" ] } ] }"
};
$.ajax(settings).done(function (response) {
console.log(response);
})
}
答案 0 :(得分:0)
未加载jQuery,因为您的javascript中有HTML标记。将此行移到HTML(在上面称为jQuery的位置):
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>;