ajax request failing with “TypeError: Cannot read properties of undefined (reading ‘open’)”

Feel like I’m missing something obvious (I don’t work with javascript or jQuery, I’m just playing around with it in my spare time), but I can’t figure out why my ajax request won’t work – can’t find the answer anywhere on google either.

When I try an ajax request with the below code, it fails with the error: ajax request failing with “TypeError: Cannot read properties of undefined (reading ‘open’)” – it doesn’t even hit my api endpoint

$.ajax({
        url: window.location.origin + "/api/test",
        type: "GET",
        dataType: "json",
        cache: false,
        contentType: "application/json"
    })
        .done(function (json) {
            conole.log(json);
        })
        .fail(function (xhr, status, error) {
            console.log(xhr);
            console.log(status);
            console.log(error);
        });

If I do it with vanilla javascript, it works fine:

var r = await fetch(window.location.origin + "/api/test", {
        method: "GET"
    });

I’ve tried messing around with all kinds of properties in the ajax request, but to no avail. What am I missing?