I have written a ajax request using getJSON of jQuery like below
$.getJSON('bDays.json', function (bDy) { // This file exists in same folder path
alert(1); // It is not executed..
});
Even if I change the code to get .txt file.. It is not working.. Kindly let me know what could be the issue with my code
Here are a couple things to try:
As pointed out by others,
bDays.jsonmust be accessible via an HTTP request. Try replacing'bDays.json'in yourgetJSONcall with its full URL.Make sure
bDays.jsoncontains valid JSON (run it through a validator, such as this one, to be certain if it is not obvious). The file needs to be valid JSON, as stated in the documentation: