Solve - $.get is not a function jQuery Error


Borislav Hadzhiev

Tue Oct 19 20212 min read


Photo by Alex Geerts

Solve - $.get is not a function #

The "$.get is not a function" jQuery error occurs for multiple reasons:

  1. Loading the jQuery slim version instead of jQuery.
  2. Loading the jQuery library twice.
  3. Specifying an incorrect path to the jQuery files.

jquery get is not a function error

To solve the "$.get is not a function" jQuery error, make sure to load the full version of the jQuery library. The slim version of the library excludes the ajax related functions. The library should only be loaded once on the page, otherwise the error is thrown.

jQuery regular version

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> </head> <body> <!-- ✅ load jQuery ✅ --> <script src="" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous" ></script> <script src="index.js"></script> </body> </html>

We loaded the full version of the jQuery library before running our script (the index.js file in the example).

Here's the content for the index.js file.

$(document).ready(function () { $.get('', function (data) { console.log(JSON.stringify(data, null, 4)); }); });

After the DOM is ready, we use the get function to make an API request and log the output to the console.

If you open the console in your browser, you'll see the response.

jquery get

If you're still getting the error, make sure you're loading the regular jQuery version (not the slim one) and you're loading the library only once.

Loading the jQuery library twice, re-runs the initialization process and causes the error.

When loading the jQuery library from a file on your local files system, make sure that the path you specify is correct and points to the right file.

Specifying an incorrect path to the jQuery script is equivalent to not loading the script at all.

You can check if the specified path is correct by opening the console in your browser and checking if you have any 404 errors related to loading the jQuery library.
Use the search field on my Home Page to filter through my more than 1,000 articles.