I have implemented unsaved changes warning before tab out to other page. So I need to save the current form before the page unload. I trigger these functions using onbeforeunload event.
if(confirm(confirm_msg)) {
save_data_using_ajax_call(url)
}
also I tried
if(confirm(confirm_msg)) {
document.form_name.submit();
return 'changes saved';
}
First method working in Firefox, But not in c开发者_如何学Gohrome. In IE8 it get returns before the form has saved. Second method not working in chrome. but works in firefox and IE. Can anyone tell me a consistent way of approach?
精彩评论