Closed Thread
Results 1 to 7 of 7

Thread: ajax script

  1. #1
    Hajjel's Avatar
    Hajjel is offline Newbie
    Join Date
    Oct 2009
    Posts
    22
    Rep Power
    0

    ajax script

    Hello
    I have a PHP script that retrieves data from another website which then insert into my database. The problem is that the script is updated using HTML (<meta http-equiv="refresh" content="1">) so when I shut down the browser so the script stops working. So I need an ajax script that runs in the background every second even when the browser is closed. I turn to you because I can't AJAX at all.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Jaan Guest

    Re: ajax script

    Well.. You can't do it with AJAX, you must use cron for it.

  4. #3
    Hajjel's Avatar
    Hajjel is offline Newbie
    Join Date
    Oct 2009
    Posts
    22
    Rep Power
    0

    Re: ajax script

    Quote Originally Posted by Jaan View Post
    Well.. You can't do it with AJAX, you must use cron for it.
    Can u write a example?

  5. #4
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Posts
    3,082
    Blog Entries
    7
    Rep Power
    42

    Re: ajax script

    cron scripts can't run more often than each minute.

    cron is similar to task scheduler in windows, but in the *nixWiki world instead. if you are on a web hotel, they need to allow you to add cron scripts. many do, most don't.
    __________________________________________
    I study Information Systems at Karlstad University when I'm not on CodeCall

  6. #5
    Jaan Guest

    Re: ajax script

    Well.. your server has to have "Cron jobs" enabled.. I mean it has to be enabled in your Control panel..

    But what Control panel are you using ?

  7. #6
    Hajjel's Avatar
    Hajjel is offline Newbie
    Join Date
    Oct 2009
    Posts
    22
    Rep Power
    0

    Re: ajax script

    Quoting a friend:
    You have a script that kicks off at startup. Then you have the while-loop with a timer routine in.

    While loop is made that it is always true, type (1 == 1), and then in the loop so you have a delay, either based on a timer or it makes a bit pointless crap in the background that takes time. It is up to you what you want to do.

    Then make it a poll on the site, and parses the poll and store relevant data in a database. Do not forget to lock the database before writing to prevent multiple writes to the same database at the same time.

    You put it in startup simply.
    According to him, should I use ajax as described above.

  8. #7
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Posts
    3,082
    Blog Entries
    7
    Rep Power
    42

    Re: ajax script

    well, sure, but then you really need a computer with a web browser open to always run that script?
    __________________________________________
    I study Information Systems at Karlstad University when I'm not on CodeCall

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. JS script tries to convert my site to site full ajax
    By pierrehs in forum JavaScript and CSS
    Replies: 2
    Last Post: 09-22-2011, 09:12 AM
  2. [HELP] convert Perl script to Bash shell script
    By Egypte in forum Linux Programming and Scripting
    Replies: 2
    Last Post: 04-24-2011, 05:37 PM
  3. PHP script writing a PHP script
    By ezcat in forum PHP Development
    Replies: 6
    Last Post: 03-08-2009, 04:47 AM
  4. SQL and AJAX
    By Jubal in forum PHP Development
    Replies: 23
    Last Post: 02-02-2009, 01:45 AM
  5. What is the difference between VB script and Java script?
    By newage123 in forum JavaScript and CSS
    Replies: 8
    Last Post: 11-14-2008, 10:49 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts