In the below code , I loop through each domains and do some operations via jQuery GET function.The Loop is synchronous. How to make each loop wait 5 seconds before it perform next GET request.
jsons = ["123.com","234.com","456.com"]
jQuery.each(jsons, function(key,ele) {
var maindomain = ele;
var apis= "https://api.panel.com/search?q="+maindomain;
$.get(apis, function(source) {
if(source == "yes")
{
$.get("https://database.com/update.php?domain="+maindomain, function(response) {
console.log("successs");
});
}
//SLEEP 5 seconds Here
});