Let's suppose I have a form with some input fields and a submit button.
If I use the window.onunload
, is it possible for me to trigger the submit button before the user leaves the webpage.
Which would be the correct way to implement it.
Something like the following might work:
$(window).unload(function() {
document.getElementById('YOURBUTTONID').submit();
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.