Re: pulling script in interval of second.

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

 



On 1 July 2014 20:04, hadi <almarzuki2011@xxxxxxxxxxx> wrote:

> Thank you louis for your code. And your help.
>
> I got another idea just listen to me. I got javascript passing "id" to my
> php script in interval time, once the "id" not being passed (its mean the
> user close javascript page). Block in if statement should run. But this
> scenario is not happening with me.


Hadi,

Please read this carefully. Just listen to me. Please.

The scenario you describe is not happening for you because that's not how
the web works. This is how the web (usually) works...

1) PHP script runs on the server.
2) PHP script outputs content which gets sent to the browser.
3) PHP script finishes running. Beyond this point PHP is NOT running
anymore.
4) Javascript that was in the content now runs in the browser.
5) The Javascript can request something from the server, but this RUNS THE
PHP SCRIPT AGAIN.
6) The PHP script knows nothing about the previous time the script ran
(i.e. steps 1-3 above).

What you are trying to do does not follow the normal way PHP scripts
interact with a browser. That's not to say it's not possible to do what you
want, but until you understand these VERY basic facts about how the web
works I have no intention of trying to explain how to do it.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

[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