I tried to update so much rows with PHP that I had to make it with ajax (becouse execution time in server is too short for execute all rows). So I made a code which should call a .php file with the code inside, which updates sended ROW id in mysql table.
I have a code
<html>
<head>
<title>Cron job!</title>
<meta charset="UTF-8" />
<script src="jquery.js"></script>
</head>
<html>
<body>
<div id="body">
</div>
<script>
$(document).ready(function(){
var array_items = <?=$table_info?>;
var updated_items = 0;
for(var i=0; i<array_items.length; i++){
// pradedam kreipimąsi į kiekvieną rową jo updeitui su ajax
$.ajax({
url: "ajax_cron.php",
type: 'POST',
dataType: 'json',
data: {update_id : array_items[i]['ids']},
success: function (data) {
// kreipimąsis pavyko
if(data.updated_id){
updated_items += 1;
}
$("#body").html(updated_items + " iš " +array_items.length + " updeitinta sėkmingai");
}, error: function(e){
console.log(e.message);
}
});
}
});
</script>
</body>
</html>
and it works when I open url with browser but when I make a call to this script with CRON JOB - ajax doesn't work.. So how to make it work?