I have a page with a link, that the user clicks to log our api out of Facebook. When you click on it, it calls a ajax function that calls a php method to delete the users keys from our database, then calls the Facebook api logout function from a JS command. This calls Facebook and ends the users session. Once logged out, it refreshes the page.
My issue is that it seems to be not waiting for the database update to finish and logouts of Facebook and refreshes the page. Since it doesn't finish it, the info is never deleted and my site never logs out. Every once in a while, it does wok, but maybe once every 10 clicks.
I put in a setTimeout for 2 secs, but it still didn't work.
Any ideas?