I want to use jquery in my Angular-TypeScript project. So I installed jquery like "npm install @type/jquery". Now when I try to serve it says:
error TS2592: Cannot find name '$'. Do you need to install type definitions for jQuery? Try npm i @types/jquery
and then add jquery
to the types field in your tsconfig.
How do I add jquery to the types field?
My Code:
let settings = {
"async": true,
"crossDomain": true,
"url": "https://api.com/getSomething",
"method": "POST",
"headers": {
"x-rapidapi-host": "xxx",
"x-rapidapi-key": "xxx",
"content-type": "xxx"
},
"data": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});