0

I know that there are similar questions here, but i couldn't find any that involve a subpage being closed.

the code has a link, "email1", which opens a subpage, the subpage has a form that is used to update some hidden values on the start page using window.opener, once that subpage is closed, the code checks to see if the values have been changed. if they were, it sends the changes to a different subpage, via ajax, which then formats and sends an email. this works fine in FF, Chrome, Opera, and Microsoft Edge. it does not work in IE11.

$(".email1").on('click', function (event) {
 var win1 = window.open("../routing/sub1.php","_blank","height=450,width=510, status=yes,toolbar=no,menubar=no,location=no");
 $(win1).on('unload', function (event){
  if(document.getElementById('hidden1').value != "z"){
   ... 
                 $.ajax({
                            type: 'post',
                            url: '/routing/sub2.php' ,
                            data: { hidden1 : document.getElementById('hidden1').value , 
                                    hidden2 : document.getElementById('hidden2').value , 
                                    hidden4 : document.getElementById('hidden4').value },
                            success: function () {
                            alert("Email has been sent!");
                            }
                        });
   }
  }
 });
});

i'm fairly certain that the issue is the unload event. I have tried adding an empty return value to the unload function. I have tried swapping 'unload' with 'beforeunload' . no luck

Bobert123
  • 103
  • 8

0 Answers0