So, I'm trying to make a (my first) Discord Bot. One command I'm coding is that each time a command is run, it adds a random number (500-1000
) to a database (https://keyvalue.immanuel.co//). I tested out the ajax command for jQuery on a small testing Replit, and it worked just fine. However, when I run THE EXACT SAME CODE on Visual Studio:
$.ajax({
type: "GET",
url: `https://keyvalue.immanuel.co/api/KeyVal/GetValue/${database_key}/balance`,
success: function (response) {
message.channel.send(`Success! ${response} points was added to the world sum!`
}
});
It gives me an error:
ReferenceError: $ is not defined
I'm so frustrated, because the following code from jQuery DOES work on my module, only ajax doesn't!
console.log(`I can use jquery to do the easy concatenation thing ${database_key}`)
And one last thing to remember: I ran the exact same AJAX code on Replit and it worked.