在ajax请求后避免任何弹出窗口阻止程序的Javascript的window.open函数

时间:2022-10-22 15:17:03

To sum it up, I collect address info, and the method of payment the user chooses, then via Ajax validate the info with PHP and if the validation fails either show the errors or will redirect the user in a new widow to PayPal. I know that window.open must be within an on click so that is the issue. I tried having the whole Ajax stuff in a function and calling the function then the redirect all within a large on click but it hasn't worked.Any ideas?

总结一下,我收集地址信息,以及用户选择的付款方式,然后通过Ajax验证PHP的信息,如果验证失败则显示错误或将用户重新定向到新的寡妇到PayPal。我知道window.open必须在点击内,这就是问题所在。我尝试在一个函数中使用整个Ajax的东西并调用该函数,然后在一个大的点击中重定向,但它没有工作。任何想法?

<- UPDATE ->

< - 更新 - >

Not great but it was solved by adding a new step, opening a nifty modal with a prompt and success message.

不是很好但是通过添加一个新步骤解决了这个问题,打开了一个带有提示和成功消息的漂亮模态。

1 个解决方案

#1


0  

you will probably need two steps in your ui, the first click validates the data via ajax, and then a button appears on success that says something like "success! open paypal". It's a kludgy UX but it will be solid in terms of implementation.

您可能需要在您的UI中执行两个步骤,第一次单击通过ajax验证数据,然后成功时出现一个按钮,表示“成功!打开paypal”。这是一个kludgy UX,但它在实施方面将是坚实的。

#1


0  

you will probably need two steps in your ui, the first click validates the data via ajax, and then a button appears on success that says something like "success! open paypal". It's a kludgy UX but it will be solid in terms of implementation.

您可能需要在您的UI中执行两个步骤,第一次单击通过ajax验证数据,然后成功时出现一个按钮,表示“成功!打开paypal”。这是一个kludgy UX,但它在实施方面将是坚实的。