I need an example of AJAX that returns the output of a php script and auto refreshes?

Has anyone got such a script?

I just need it to run a php script/file and return the output to the page say every 10 seconds?

Cheers


Comments

One Response to “I need an example of AJAX that returns the output of a php script and auto refreshes?”

  1. just "JR" on July 31st, 2010 5:33 pm

    Google for "Sajax" (AJAX for php, very efficient and easy to use).
    To refresh every 10 secs:
    <script>
    setTimeout ( "refresh_me ( )", 10000 );
    function refresh_me()
    {
    sajax_target_id = ‘id_to_refresh’;
    x_p_refresh_me ( );
    sajax_target_id = ”;
    setTimeout ( "refresh_me ( )", 10000 );
    }
    </script>
    <?php
    function p_refresh_me()
    {
    do something;
    return (something);
    }
    ?>

Powered by Yahoo! Answers