简体   繁体   中英

after redirect, other functions are not working in Chrome

I am new to jQuery, please help.

After window.location.href other functions are not getting called/ aborted.

I am using Spring to catch that url("downloadPack?Name=" + Name + "&ID="+ID) and generating excel file , till this point it is working fine.

below code works perfectly on Firefox and IE , but having issues with Google Chrome only.

var href_red = "downloadPack?Name=" + Name + "&ID="+ID ;


                    jQuery
        .post(
                'checkPack',
                {
                    Name :Name,
                    ID : ID,
                    Date :Date,

                    },
                function(data) {
                    if (data == 1) {
                        window.location.href = href_red;

                        dialog_load('Download Workbook','downloadOptions', '675px', '630px', 2);



                    } else {
                        dialog_error('Error','workbook has not yet been created, please create it first');
                    }

                });

Changing the window.location will kill all scripts currently running in the browser.

So you need to add that code before you are redirecting.

Or other solution is getting a page via AJAX and run a callback function to execute when the content is loaded.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM