$.getJSON(url, function (data) {
$.getJSON(url_wind, function (data2) {
//do stuff with 'data' and 'data2'
});
});
when I use the data of the first getJSON()
in the 2nd getJSON()
there is an error saying undefined
help me please
Use the promises rather this nesting. it's easy to debug.
Call it like this with async await.
(async function () {
let data = await $.getJSON(url);
let data2 = await $.getJSON(url_wind);
console.log(data, data2);
})();
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.