var pageTotal = 1; if ($(".pagination li:nth-last-child(2) a").html() !== undefined) { pageTotal = parseInt($(".pagination li:nth-last-child(2) a").html()); } var url = window.location.href + "?sayfa="; var i; function sleep(delay) { var start = new Date().getTime(); while (new Date().getTime() < start + delay); } for (i = 1; i <= pageTotal; i++) { $.get( url + i, function(data) { var regex = /<\/i>/gm; var m; while ((m = regex.exec(data)) !== null) { if (m.index === regex.lastIndex) { regex.lastIndex++; } var productId = m[1]; $.ajax({ type: "POST", url: "https://dolap.com/product/unlike/" + productId, async: false }); setTimeout(() => { console.log("Bekleniyor!"); }, 2000); } } ); }