简体   繁体   中英

ReferenceError: “$” is not defined

Getting error ReferenceError: "$" is not defined. when below function is run. I have enabled Sheets API in both Google API console & Advanced Google Services

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);
})
}

jQuery is not being loaded because you have an HTML tag in your javascript. Move this line out into the HTML, above where you call jQuery:

  <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM