Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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));
  })()
}
 
PREVIOUS NEXT
Tagged: #javascript #return #data #async
ADD COMMENT
Topic
Name
6+8 =