実行される cron ジョブをスケジュールしましたが、そのジョブは ajax 呼び出しを実行するはずですが、実行されません。レンダリングされるページは、次のようなものです。各スクリプトを 1 つずつ実行して応答を待つことはできませんが、それらはすべて長く保持されるため、非同期で実行する必要があります。ローカルホストでこのページを開くと、以下の html がレンダリングされ、完全に実行され、ajax を介して他のインスタンスが開始されます。しかし、オンライン サーバーに配置し、curl を使用して cron として起動すると、ajax は実行されず、ページはレンダリングされるだけです。
<html lang="en">
<head>
<script type="text/javascript" src="./assets/jquery.js"></script>
</head>
<body>
//execute some php here
<script>
var numberOfInstances = "4";
var userId = ["82372","93823","28372","39823"];
//Ajax call to url that is supposed to run for each user id
function startAnotherInstance(i){
$.ajax({
url: "./getreplies.php?instance="+i+"&userid="+userId[i],
type: 'GET',
data: null,
success: function() {
}
});
}
//Initialize the number of instances
for (i=0;i<numberOfInstances;i++){
startAnotherInstance(i);
}
</script>
</body>