As with the first successful query, run another query on the next element from the array?
php
$arr = array(1, 4, 6, 8, 9, 12); js
$(function(){ $(".buton").click(function(){ var id = "<?php echo $arr[0]; ?>"; $.ajax({ url: "Ajax.php", type: "POST", data: {id: id}, success: function(html){ if (html == 1){ // Если запрос успешный и ответ равен == 1. // Вполняем следующий Ajax запрс. }else{ alert("Ошыбка !!!"); } } }); }); });