How do I know if the user is updating the page [closed]

3

The user is filling the cart with various items, and I have created a jQuery function where items are summed up instantly and presented to it. As soon as he finishes choosing the items and clicking the continue button, the items and value are saved in the database. However, if he refreshes the page by pressing f5, or clicking on the browser image to refresh, the values and items are cleared from the screen.

So far, the problem is that are not zeroed out of the database , I would like to know how to identify this update, so that I can work with ajax and also delete database data.

    
asked by anonymous 16.03.2015 / 19:27

1 answer

0

You can use a function in onexit, and when you exit the page the function is called. What you would need is to know which session id the user is on, and before destroying the session, give a delete of the base, based on the session data that is being destroyed.

    
15.04.2015 / 21:59