I am executing the two javascript function
1) function ===> calling web api and reading the values
------if first function return the value then no need to call the second function
2) second function===> dynamically creating the table
but every time it's calling the second function because first function is working as asynchronous and giving me output after second function execution .
As I said, nest them
function functionxyz(){
// do stuff, do another safe ajax etc etc
}
function functionabc(){
var exists = false;
var variable = some value;
webapi.safeAjax({
type: "GET",
url: "api url",
contentType: "application/json",
success :function (res){
res.value.forEach(function(record){
if(record.column==variable ){
exists=true;
console.log("Match");
}else{
exists=false;
console.log("Non Match");
}
})
if(exists == true){
functionxyz();
}
}
}
functionabc();
Could also chain webapi.safeAjax(............).then(//next call here etc)
Chain them together or nest them - depending on what you are doing use .then() or call the second one from inside the results of the first one.
Fubar
62
Super User 2025 Season 2
Lucas001
48
Super User 2025 Season 2
KevinGador
44
Super User 2025 Season 2