I'm trying to load a json file when the page is loaded. So I tried this code:
$( document ).ready(function() {
$.getJSON("./db/url.json", function(json) {
console.log(json);
});
console.log("The page is loaded");
});
resulted in this error:
[Show/hide message details.] TypeError: $.getJSON is not a function[Learn More]
I read some similar posts, but I still can't figure it out. can you help?
The same result if I use $.ajax
Make sure you do not use the slim version (differences are in the link attached).
slim version does not include .ajax
and .getJSON
.
full version for jquery-3.1.1.min.js can be found here.
test it and check the result.