I want to load some data from a json file, but the content doesn't show up and also the browser console doesn't return any error. Here's the script:
(function($){
$(window).load(function(){
$.getJSON('./assets/js/data.json', function(datas){
console.log(datas);
}); //get JSON
}); //window.load
});
And am calling the script file like:
<script src="assets/js/ajax.js"></script>
What could be wrong?
--------------more info about issue
when i use $(function(){}) AND $(window).load() chrome dont return any error in console, but the data.json not issued in network tab.
and when i don't use $(function(){}) AND $(window).load() the data.json is issued but cant load and the chrome return below errors: