Re: Updating HTML on page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 05, 2010 at 09:29:26PM -0600, Ashley M. Kirchner wrote:

> Hrm, been looking at it for a while now and I can feel a headache coming up.
> I think I need to have one PHP script that does the processing, and another
> that the user pulls up in their browser.  That one "pings" the processor
> every so often to get updated data.  Yes?
> 
> Am I way off here?

Slightly. PHP code runs on the server, so in the browser, it won't
"ping" the server.

Yes, you should have a PHP script on the server to do the processing,
(call it, say, "process.php") and one which paints the basic screen for
the browser (call it "page.php" or somesuch). But the connection between
these should be AJAX code in the page.php script. That will most likely
be Javascript in the page.php script which will "ping" the process.php
script for whatever contents you want.

The Javascript to do this is beyond the scope of this list (it's a PHP
list, after all). The "process" script doesn't have to be PHP. It could
be any language you prefer, as long as you can get it to return JSON or
XML to page.php, so that the Javascript in the page.php script can
interpret it.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux