简体   繁体   中英

$.getJSON's success function not being called

I'm trying to load a .json file with this line:

$.getJSON('engines.json',{},function(data){
    alert(data);
});

If I look in firebug, it says the file is loaded. But the success function never runs. It happens with $.get as well.

You need to ensure that the JSON file you are requesting for, it is actually well formatted and valid .

You can validate your JSON file/response using this online validator: http://jsonlint.com/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM