php - At startup, run AJAX request every 10 seconds -
This is in response to the SO problem found here - & gt;
This post has helped so much, but when I tried to do it in accordance with my needs, it was not working right now.
I have a PHP script which is my database. When I point directly to my browser at 'create_new_job.php', then the script works fine. My problem is that I do not seem to run an AJAX request to run scripts per 10 seconds when my main page loads can.
My PHP script: 'create_new_job.php'
My main page: index.php
to enter data in the database is in my index.php :
& lt; Script & gt; Function newjobs () {var inputjob = $ .ajax ({url: "create_new_job.php", complete: scheduling webs}}; Inputjob.done (function) (warning ('job added!');} Inputjob.fail (Function (data) {warning ('job not added ....')}}} function schedulonwibes () {setTimeout ( First of all, I get an error on line
function () {newjobs ();}, 10000);} & lt; / script & gt; But when I remove 'done' and 'unsuccessful' notice, nothing No data is entered and I get an error I am not trying to retrieve any data - I just want to run 'create_new_job.php' every 10 seconds. Any The help will be greatly appreciated.
You are not closing your functions properly, and the function To run every ten seconds, you can make it recursive, by calling it again with done () callback, or you can use an interval Not (function newjobs) {var inputjob = $ .ajax ({url: Create_new_job.php "}); Inputjob.done (function ('job added!'); SetTimeout (wjobs, 10000); // recurring}}; ^ ^ missing mput inputjob.fail (function () {warnings (' Job was not added .... ');});}) ();
Comments
Post a Comment