I have this Index.php wants to work as needed to execute each request at each defined time:
<html>
<head>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<style>
textarea:hover, input:hover, textarea:active, input:active, textarea:focus, input:focus {
outline:0px !important;
}
button:focus {outline:0;}
::-webkit-scrollbar {
width: 5px;
}
::-webkit-scrollbar-track {
background: black;
}
::-webkit-scrollbar-thumb {
background: blue;
}
::-webkit-scrollbar-thumb:hover {
background: blue;
}
</style>
<title>ADFocus</title>
</head>
<body>
<center>
<div id="cor">
<div><h1></h1>
<h4></h4>
</div>
<hr>
</div>
<textarea id="lista" name="lista" rows="5" required="" cols="1" style="overflow:auto; width:50%; height:50%; text-align: center;" cols="1" placeholder=""></textarea>
<br>
<font color="black">
Aprovadas : <span id="cLive" class="badge badge-pill badge-success">0</span> -
Reprovadas : <span id="cDie" class="badge badge-pill badge-danger">0</span> -
Testadas: <span id="total" class="badge badge-pill badge-warning">0</span> -
Total : <span id="carregadas" class="badge badge-pill badge-info">0</span></font>
<br>
<button class="btn btn-outline-primary" style="width: 500px; outline: none;"id="testar" onclick="enviar()">TESTAR</button>
<hr>
<span class="aprovadas" id=".aprovadas"></span>
<span class="reprovadas" id=".reprovadas"></span>
</center>
</body>
<script title="ajax do checker">
function enviar() {
var linha = $("#lista").val();
var linhaenviar = linha.split("\n");
var total = linhaenviar.length;
var ap = 0;
var rp = 0;
linhaenviar.forEach(function(value, index) {
setTimeout(
function() {
$.ajax({
url: 'api.php?lista=' + value,
type: 'GET',
async: true,
success: function(resultado) {
if (resultado.match("#Aprovada")) {
removelinha();
ap++;
aprovadas(resultado + "");
}else {
removelinha();
rp++;
reprovadas(resultado + "");
}
$('#carregadas').html(total);
var fila = parseInt(ap) + parseInt(rp);
$('#cLive').html(ap);
$('#cDie').html(rp);
$('#total').html(fila);
}
});
}, 3000 * index);
});
}
function aprovadas(str) {
$(".aprovadas").append(str + "<br>");
}
function reprovadas(str) {
$(".reprovadas").append(str + "<br>");
}
function removelinha() {
var lines = $("#lista").val().split('\n');
lines.splice(0, 1);
$("#lista").val(lines.join("\n"));
}
</script>
He pauses between each test as I want.
However I needed that same Pause but with this HTML.
<!DOCTYPE html>
<!--get out, you will not copy my html-->
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title>Checker GG</title>
<link rel="shortcut icon" href="">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="http://webapplayers.com/luna_admin-v1.1/vendor/animate.css/animate.css"/>
<link rel="stylesheet" href="http://webapplayers.com/luna_admin-v1.1/vendor/bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<link rel="stylesheet" href="http://webapplayers.com/luna_admin-v1.1/styles/pe-icons/pe-icon-7-stroke.css"/>
<link rel="stylesheet" href="http://webapplayers.com/luna_admin-v1.1/styles/pe-icons/helper.css"/>
<link rel="stylesheet" href="http://webapplayers.com/luna_admin-v1.1/styles/stroke-icons/style.css"/>
<link rel="stylesheet" href="http://webapplayers.com/luna_admin-v1.1/styles/style.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
</head>
<!--my own css-->
<style>
body{
overflow-x: hidden;
}
#top-bar{
background-color: #3E3D3D;
width: 100%;
height: 60px;
background-color: #;
position: relative;
top: -20px;
}
#title-top-bar{
position: relative;
top: 5px;
color: white;
font-weight: bold;
font-family: 'Quicksand', sans-serif;
left: 55px;
}
#logo-top-bar{
width: 60px;
position: relative;
top: -50px;
}
#shop-redirect-mold{
width: 100px;
height: 100px;
background-color: #202a38;
border-radius: 100%;
position: relative;
top: -100px;
}
#shop-redirect-mold2{
width: 90px;
height: 90px;
background-color: #d6d6d6;
border-radius: 100%;
position: relative;
top: -195px;
}
#db-list-box{
background-color: #212a36;
width: 70%;
height: 350px;
border-radius: 5px;
position: relative;
top: -20px;
}
#lista{
background-color:#2e;
width: 100%;
height: 200px;
resize: none;
position: relative;
top: 0px;
font-weight: bold;
font-family: 'Quicksand', sans-serif;
font-size: 15px;
color: #686868;
text-align: center;
overflow-x: hidden;
border-color: white;
border-left: none;
border-right: none;
}
#botao{
background-color:#2e;
width: 100%;
height: 200px;
resize: none;
position: relative;
top: 0px;
font-weight: bold;
font-family: 'Quicksand', sans-serif;
font-size: 15px;
color: #686868;
text-align: center;
overflow-x: hidden;
border-color: white;
border-left: none;
border-right: none;
}
#db-list-title{
position: relative;
top: 5px;
color: white;
font-size: 30px;
font-weight: bold;
font-family: 'Quicksand', sans-serif;
}
#db-list-result-cont{
color: white;
font-family: 'Quicksand', sans-serif;
}
#result-box{
position: relative;
left: 205px;
top: -10px;
background-color: #212a36;
width: 800px;
height: 250px;
border-radius: 5px;
color: white;
font-weight: bold;
font-family: 'Quicksand', sans-serif;
}
#lives{
width: 100%;
background-color: #1a222e;
height: 200px;
resize: none;
position: relative;
top: 0px;
font-weight: bold;
font-family: 'Quicksand', sans-serif;
font-size: 15px;
color: #28a745;
text-align: center;
overflow-x: hidden;
border-color: white;
border-left: none;
border-right: none;
}
#dies{
width: 100%;
background-color: #1a222e;
height: 200px;
resize: none;
position: relative;
top: 0px;
font-weight: bold;
font-family: 'Quicksand', sans-serif;
font-size: 15px;
color: #dc3545;
text-align: center;
overflow-x: hidden;
border-color: white;
border-left: none;
border-right: none;
}
#socks{
width: 100%;
background-color: #1a222e;
height: 200px;
resize: none;
position: relative;
top: 0px;
font-weight: bold;
font-family: 'Quicksand', sans-serif;
font-size: 15px;
color: #ffc107;
text-align: center;
overflow-x: hidden;
border-color: white;
border-left: none;
border-right: none;
}
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: #1a222e;
}
::-webkit-scrollbar-thumb {
background: #888;
}
::-webkit-scrollbar-thumb:hover {
background: #555;
}
</style>
<!--website content-->
<body class="animated bounce">
<!--top bar and navegation-->
<!--first text box-->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/darkly/bootstrap.min.css" rel="stylesheet" integrity="sha384-S7YMK1xjUjSpEnF4P8hPUcgjXYLZKK3fQW1j5ObLSl787II9p8RO9XUGehRmKsxd" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Poiret+One" rel="stylesheet">
</head>
<body>
<center> <br>
<h1 style="font-family: 'Poiret One', cursive; font-size: 30px;"> Checker GG ELO2</h1>
<script defer src="https://use.fontawesome.com/releases/v5.0.8/js/all.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript"></script>
<center>
<textarea id="list" name="lista" rows="5" required="" cols="1" style="overflow:auto; width:50%; height:50%; text-align: center;" cols="1" placeholder="" maxlength="670"></textarea>
<textarea name="socks" id="socks" rows="9" class="form-control" style="width:1%;text-align:left;resize:none;margin-left:-10140px;margin-top:-193px;" placeholder=""></textarea>
<span style="outline: none; overflow:auto; color: #FFF; resize:none; color: white; text-align: center;">Status: </span> <span class="badge badge-custom" id="status">Aguardando...</span>
<br> <span style="outline: none; overflow:auto; color: #FFF; resize:none; color: white; text-align: center;">Carregadas: </span> <span class="badge badge-secondary" id="total">0</span>
<span style="outline: none; overflow:auto; color: #FFF; resize:none; color: white; text-align: center;">Aprovados: </span> <span class="badge badge-success" id="live">0</span>
<span style="outline: none; overflow:auto; color: #FFF; resize:none; color: white; text-align: center;">Reprovadas: </span> <span class="badge badge-danger" id="die">0</span>
<span style="outline: none; overflow:auto; color: #FFF; resize:none; color: white; text-align: center;">Testadas: </span> <span class="badge badge-warning" id="testadas">0</span>
</div>
</div>
<br>
<br>
</center>
<div class="button-list">
<button class="btn btn-success" type="submit" id="start">INICIAR</i></button>
<button class="btn btn-danger" type="submit" id="stop">PARAR</button>
<button class="btn btn-warning" type="submit" id="clear">LIMPAR</button>
</div>
<script>
var audio = new Audio('blop.mp3');
$(document).ready(function () {
$('#status').html('<span id="bad" class="badge badge-danger">N??o iniciado !</span>');
$('#start').attr('disabled', null);
$('#clear').attr('disabled','disabled');
$('#stop').attr('disabled','disabled');
$('#start').click(function () {
audio.play();
var line = $('#list').val().split('\n');
var total = line.length;
var ap = 0;
var rp = 0;
var sd = 0;
$('#total').html(total);
line.forEach(function (value) {
var ajaxCall = $.ajax({
url: 'api.php',
type: 'GET',
data: 'lista=' + value,
beforeSend: function () {
$('#status').html('<span class="badge badge-success">Testando !</span>');
$('#stop').attr('disabled',null);
$('#stop').attr('disabled',null);
$('#start').attr('disabled','disabled');
},
success: function(data){
if(data.indexOf("Aprovada") >= 0){
$("#aprovadas").val(data + "\n" + $("#aprovadas").val());
ap = ap + 1;
document.getElementById("aprovadas").innerHTML += data + "<br>";
audio.play();
removelinha();
}else{
$("#reprovadas").val(data + "\n" + $("#reprovadas").val());
rp = rp + 1;
document.getElementById("reprovadas").innerHTML += data + "<br>";
removelinha();
}
var fila = parseInt(ap) + parseInt(rp);
$('#live').html(ap);
$('#die').html(rp);
$('#testadas').html(fila);
if (fila == total) {
$('#start').attr('disabled', null);
$('#stop').attr('disabled', 'disabled');
$('#clear').attr('disabled',null);
$('#status').html('<span class="badge badge-info">Teste Finalizado !</span>');
audio.play();
}
}
});
$('#stop').click(function(){
ajaxCall.abort();
$('#start').attr('disabled',null);
$('#stop').attr('disabled','disabled');
$('#clear').attr('disabled',null);
});
});
$('#stop').click(function(){
$('#status').html('<span class="badge badge-danger">Parado !</span>');
});
$('#clear').click(function(){
$('#status').html('<span class="badge badge-secondary">Lista Limpa!</span>');
$('#list').val('');
});
});
});
function removelinha() {
var lines = $("#list").val().split('\n');
lines.splice(50, 50);
$("#list").val(lines.join("\n"));
}
</script>
</div>
</center>
<center><br>
<div class="container">
<div class="panel panel-content">
<div style="text-align: center;" class="panel-heading"><i class="fas fa-check-circle"></i><strong> APROVADAS </strong><i class="fas fa-check-circle"></i></div>
<div style="font-size: 15px;" class="aprovados">
<div id="aprovadas" class="card-body"></div>
</div>
</div>
<div class="panel panel-content">
<div style="text-align: center;" class="panel-heading"><i class="fas fa-times-circle"></i> REPROVADA <i class="fas fa-times-circle"></i></div>
<div style="font-size: 15px;" class="reprovadas">
<div id="reprovadas" class="card-body"></div>
</div>
</div>
</center>
</html>
I'm running on LocalHost I have no problem with HTML, my question how to put this Pause as in the First in the Example.
You don't need any setTimeout in this case; You need to use Promises, async/await in JavaScript; when you send a request to API, it will wait until you get a response from it.
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
JavaScript is a multi-paradigm language that supports event-driven, functional, and mandatory (including object-oriented and prototype-based) programming types. Originally JavaScript was only used on the client side. JavaScript is now still used as a server-side programming language. To summarize, we can say that JavaScript is the language of the Internet.
https://www.javascript.com/
JQuery is arguably the most popular JavaScript library with so many features for modern development. JQuery is a fast and concise JavaScript library created by John Resig in 2006. It is a cross-platform JavaScript library designed to simplify client-side HTML scripting. Over 19 million websites are currently using jQuery! Companies like WordPress, Facebook, Google, IBM and many more rely on jQuery to provide a kind of web browsing experience.
https://jquery.com/
CSS (Cascading Style Sheets) is a formal language for describing the appearance of a document written using a markup language.
It is mainly used as a means of describing, decorating the appearance of web pages written using HTML and XHTML markup languages, but can also be applied to any XML documents, such as SVG or XUL.
https://www.w3.org/TR/CSS/#css
Bootstrap is not exclusively a CSS framework, but its most popular features are CSS-centric. These include a powerful grid, icons, buttons, map components, navigation bars, and more.
https://getbootstrap.com/
There are several libraries that do almost the same thing: add one or more animations to a specified element. The first such library to gain popularity in recent years was Dan Eden's Animate.css. This fun library contains dozens of built-in animations that shake, fade, slide, scale, and more.
https://animate.style/
HTML (English "hyper text markup language" - hypertext markup language) is a special markup language that is used to create sites on the Internet.
Browsers understand html perfectly and can interpret it in an understandable way. In general, any page on the site is html-code, which the browser translates into a user-friendly form. By the way, the code of any page is available to everyone.
https://www.w3.org/html/
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.