delickate Posted November 21, 2009 Share Posted November 21, 2009 Hi, Is it possible to call a php function on page close? If yes, could you explain how and where to call? any example code will be appreciated. Thanks Link to comment https://forums.phpfreaks.com/topic/182398-help-calling-function/ Share on other sites More sharing options...
cags Posted November 21, 2009 Share Posted November 21, 2009 Certainly not using PHP directly. Javascript may be able to catch an event, but I don't know Javascript well enough to know if they have a 'closing' event trigger. Link to comment https://forums.phpfreaks.com/topic/182398-help-calling-function/#findComment-962492 Share on other sites More sharing options...
delickate Posted November 21, 2009 Author Share Posted November 21, 2009 Yea javascript could call on page unload but i need to call php function. I would like to delete data when some one close the page. It means I've to use AJAX tech. Link to comment https://forums.phpfreaks.com/topic/182398-help-calling-function/#findComment-962506 Share on other sites More sharing options...
cags Posted November 21, 2009 Share Posted November 21, 2009 As you say you will have to use the Javacript event to trigger an Ajax call to your php script. Link to comment https://forums.phpfreaks.com/topic/182398-help-calling-function/#findComment-962507 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.