faqts : Computers : Programming : Languages : PHP : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

29 of 43 people (67%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

its possible to call any php function or command in the middle of a javascript??? for example to call a session_destroy(); in a onUnload java function

Nov 29th, 2000 04:59
Craig Fratrik, Julio Saura,


No, javascript is run by the browser, PHP is run by the server.  After 
PHP is run and the result sent to the browser, it can run no more.  The 
easiest thing to do in this situation is to transfer the person to 
another page, there you can destroy the session.  However, this kind of 
messes them up, because now they're not going where they were going.  
My new solution is to open a new window which will run the 
session_destroy function and then say something like, "Good Bye."