Answers for "javascript return data async"

0

javascript return data async

// This is your API Call (Can be jQuery, AXIOS, fetch...)
function postAJAX(id){
  return jQuery.getJSON( "/jsonURL" + id, function( data ){});
}

// This is your asyncronous returned data 
function getTheContent(id){
  (async () => {
    console.log(await postAJAX(id));
  })()
}
Posted by: Guest on April-11-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language