I have made a form in drupal.
What I want is when the browser unload the page from any click whether by clicking on anchor tag or from browser refresh buttons I want to save data of my form through js/ajax or anything possible in drupal.
If any more explanation needed please do ask me. Thanks in advance.
I was trying do this by browser ‘unload’ event and ‘beforeunload’ event. But unable to save data of my form because browser doesn’t wait for anything writtent inside and just ask for confirmation. Any help will appreciated.
This what I was trying to do:
$(window).bind('beforeunload', function() { return 'Do you really want to leave?'; //coming here instead of it what i want //is save the form then return if user says yes and no the don't save the form. });
Sponsored by SupremePR