I have installed the jQuery typings in my TypeScript project. I can type $.ajax(...) without any compile errors in VS Code. However, when I check it in localhost, I get an error saying that "$ is not defined". I tried to fix it by importing jQuery like so:
import * as jQuery from "jquery"
I imported express in the same way, and it works.
When I type "jquery." in VS Code, VS Code auto-suggests "ajax" as a method call, so it knows about my import. But when I check it in localhost again, it tells me jquery.ajax is not a function.
My test ajax call:
jquery.ajax("test.html", {
success: function () {
alert("success");
},
error: function () {
alert("error");
}
});
How can you make an ajax call with jQuery with TypeScript?