I am getting error
Uncaught SyntaxError: Illegal break statement
on break;
, i am want to stop for
loop if server return 5. I am using below code:
<script type="text/javascript">
function getrblstatus(rbl, hash) {
var rblhosts = [<?php echo $rblhosts ?>];
var ActiveRbls = rblhosts.length;
var progress = '1';
for (i = 0; i < ActiveRbls; i++) {
///// Post data to server /////
$.ajax({
url: '<?php echo $site_url?>/includes/lib/ajax.php',
data: {
action: 'getrblstatus',
for: rbl,
hash: hash,
rbl_host: rblhosts[i]
},
type: 'post',
success: function (data) {
var percent = (progress/ActiveRbls)*100;
percent = percent.toFixed(2);
if(data == 5) {
console.log('Hash not correct');
break;
}
else{
$('#rbl_table > tbody').append(data);
$('#progressbar').width(percent+'%');
$("#progressbar").html(percent+"% Completed");
progress ++;
continue;
}
}
});
}
}
</script>