简体   繁体   中英

Refresh the page after click OK on alert box

In checkout page of my magento store, I need to clear some inputs when an alert box is showed and user press OK. Is possible to do that?

I have no control over the javascript alert. So I think in a script that detect an alert with a specific message and clear inputs when button of that alert is clicked.

UPDATE

Fixed!

file: opcheckout.js line: 888

I add location.reload(); because document.location.reload(true); not work on IE. Thanks everybody!

Probably try overriding default alert and write a custom function like below,

var c_alert = alert;

window.alert = function (str) { //override default alert
    c_alert(str + ' my message');
    location.reload();
    //or write code to clear input fields here
}

//below seems to be triggered from somewhere where you don't have control.
alert('test');

Javascript

if(confirm('your confirmation text')){
document.location.reload(true);
}

Make it refresh after the alert. The javascript code shouldn't execute before the alert is gone

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