javascript - Refresh the page after click OK on alert box - Stack Overflow

In checkout page of my magento store, I need to clear some inputs when an alert box is showed and user

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!

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!

Share Improve this question edited Jul 17, 2013 at 21:12 user2433958 asked Jul 17, 2013 at 20:14 user2433958user2433958 171 silver badge8 bronze badges 2
  • Could you clarify on which action magento shows alert? – Artem Latyshev Commented Jul 17, 2013 at 20:35
  • @ArtemLatyshev I am using a payment module with credit cards and need to modify it to be accepted by the credit card pany. When the customer inserts a number of invalid credit card and click on Place order button, the module displays a message (alert). – user2433958 Commented Jul 17, 2013 at 20:40
Add a ment  | 

3 Answers 3

Reset to default 3

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745618827a4636396.html

相关推荐

  • javascript - Refresh the page after click OK on alert box - Stack Overflow

    In checkout page of my magento store, I need to clear some inputs when an alert box is showed and user

    9小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信