简体   繁体   中英

Cron job does not load a function

I'm running a php page on the server with cron job. There is a function in the php page.

  • The line load('sonucal.php') does not work. (main.php)
  • The line window.location.replace('main.php?abc='+def+'') does not work. (sonucal.php)

This php page is working actively with cron job.

main.php

...
...

    <script type="text/javascript">
        $(document).ready(function(){
        setInterval(function()
            {
            $('#fare').load('sonucal.php')
        },1000);
        });
    </script>

sonucal.php

echo "
...
...
window.location.replace('main.php?abc='+def+'');
</script>";

You can not run a cronJob in a web browser. The cronJob are automated tasks that are run on a server, therefore every so often a window.location (?) will open.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM