Thank you! After going through your code when I go to:

keepLive.php?wait=e

I get:

1199743545

And when i load  the HTML page, I get no input and no errors, with my
code below:


<html>
    <head>
<script src="js/jquery-1.2.1.pack.js" type="text/javascript"></script>
        <script>
            jQuery(function()
            {
                $('input#hurumph').click(function()
                {
                    $.ajax(
                    {
                        url: 'keepLive.php?wait=' + $('#in').val(),
                        success: function(sReturn)
                        {
                            $('span#time').html(sReturn);
                        }
                    });
                });
            });
        </script>
    </head>

    <body>
        What time is it in&#160;<input id="in"/
>&#160;seconds&#160;<input
type="button" value="?" id="hurumph"/>
        <br/>
        ?:&#160;<span id="time"/>
    </body>
</html>

Here is my new code: http://pastie.caboo.se/136398 that is the code
that i am trying to implement it with. To see other peoples action on
the site, in that case what would be my PHP be? I have been at many
many articles on this and just need some one on one for explanation.
Thanks for that demo!

On Jan 6, 10:01 pm, "Morgan Allen" <[EMAIL PROTECTED]> wrote:
> A simple way to do this in PHP is using a loop to wait for an event, and
> return if and when it does. Otherwise the connection times out, and the
> client (web browser using XMLHttpRequest) reconnects. A really simple
> demonstration can be seen by just doing an ajax request to a php script that
> sleep()'s. Here is an example.
>
> <?php
>     if($_REQUEST['wait'])
>     {
>         sleep($_REQUEST['wait']);
>         echo time();
>         die();
>     }
> ?>
> <html>
>     <head>
>         <script src="/js/jquery.js" type="text/javascript"></script>
>         <script>
>             jQuery(function()
>             {
>                 $('input#hurumph').click(function()
>                 {
>                     $.ajax(
>                     {
>                         url: 'index.php?wait=' + $('#in').val(),
>                         success: function(sReturn)
>                         {
>                             $('span#time').html(sReturn);
>                         }
>                     });
>                 });
>             });
>         </script>
>     </head>
>
>     <body>
>         What time is it in&#160;<input id="in"/>&#160;seconds&#160;<input
> type="button" value="?" id="hurumph"/>
>         <br/>
>         ?:&#160;<span id="time"/>
>     </body>
> </html>
>
> Just takes a simple input and wait the given amount of time. You can see
> from this that you could easily wait for any other sort of event. Like
> another user making and update. At that the point the connection get closed,
> and the client just restarts it.
>
> On Jan 6, 2008 3:56 PM, coughlinsmyalias <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Hey all, i have been researching googling and many other ways to try
> > to find out how to make my site as close to "live" as I can.
>
> > I read this by John:http://ejohn.org/blog/streaming-http-server-push/
> > but am still kind of confused. My site is:
>
> >http://rksdesignstudios.com/magnet/
>
> > - Drag a word
> > - Add a word
> > - Delete
>
> > And many features to come, etc. I want to make it like you can seeo
> > ther changes being made..stuff being dragged, any idea how to do this?
> > I have been STUMPED on this.
>
> > Thanks!
> > Ryan
>
> --http://morglog.alleycatracing.com
> Lets make up more accronyms!
>
> http://www.alleycatracing.com
> LTABOTIIOFR! ROFL! ROFL! ROFL!
> Upcoming alley cats, reviews, touring logs, and a general congregation of
> bike nerdity.

Reply via email to