I'm trying to get each array link on some interval. For example: I get first link, wait for 30 seconds, next link, wait for 30 seconds another link etc. Here is my code:
var urls = [ 'http://mylink1','http://mylink2','http://mylink3','http://mylink4'];
setInterval(function(){
urls.forEach(function(entry){
console.log(entry);
ajaxd(entry);
console.log("merge pana aici");
});
},30000);
function ajaxd(my_url) {
$.ajax({
type : "POST",
url : my_url,
success : function(msg) {
console.log(my_url);
}
});
}
And the problem is, after 30 seconds I get all the links. Not first value, wait for 30 seconds, next value and so on..