I am working on questionnaire that is being asked when user lands on the page, if he agrees to do it popup window (action is on different Controller) is opened (works fine) an when main window is closed it should signal to popup to start questionnaire. However following mechanism does not seem to trigger the startSurvey
function.
$('.askForFeedback a.yes').click(function() {
window.survey = window.open("../Home/CustomerFeedback", "Customer Feedback", "width = 600px, height = 400px");
window.onbeforeunload = function() {
window.survey.startSurvey = function() {
$('.survey-questions').show();
$('.leave-window-open').hide();
};
window.survey.startSurvey();
};
});
Could it be because of different MVC controller or maybe because of onbeforeunload
? I must be missing something obvious here.
For those wondering this does work.
$('.askForFeedback a.yes').click(function() {
window.survey = window.open("Home/CustomerFeedback", "Customer Feedback", "width = 600px, height = 400px");
window.onbeforeunload = function() {
$(window.survey.document).find('.survey-questions').show();
$(window.survey.document).find('.leave-window-open').hide();
};
});