I'm new with Javascript and I would like to read a remote JSON file with getJSON()
. For some reason my function returns a syntax error Unexpected token )
but I can't figure out what is wrong.
This is what I do, am'I missing something ?
var url = "http://mysafeinfo.com/api/data?list=englishmonarchs&format=json";
$.getJSON(url, function (json) {
console.log(json);
alert(json);
)};
You have a javascript error
var url = "http://mysafeinfo.com/api/data?list=englishmonarchs&format=json";
$.getJSON(url, function (json) {
console.log(json);
alert(json);
}); // here swapped the bracets
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.