Skip to content

Instantly share code, notes, and snippets.

@Ginnw2
Created April 16, 2021 14:27
Show Gist options
  • Save Ginnw2/cdd7679a2536ffead6e1d00ee141a905 to your computer and use it in GitHub Desktop.
Save Ginnw2/cdd7679a2536ffead6e1d00ee141a905 to your computer and use it in GitHub Desktop.
Пошаговая работа скрипта.
<div class="loader">Loade...</div>
<div class="step"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script type="text/javascript">
function func(i)
{
var form_data = new FormData();
form_data.append('ITER', i);
$.ajax({
type: "POST",
async: true,
url: '/hlCoordinateSetter.php',
cache: false,
contentType: false,
processData: false,
data: form_data,
beforeSend: function() {
$('.loader').show();
},
success: function(result) {
console.log(result);
$('.step').html(result);
var nextstep = parseInt(result)+1;
setTimeout(func, 5000, nextstep);
},
error: function(error) {
alert('error; ' + eval(error));
},
complete: function() {
$('.loader').hide();
}
});
}
var i = 1;
setTimeout(func, 300, i);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment