简体   繁体   English

json.success重定向到谢谢页面

[英]json.success redirect to thank you page

I have this code in one of my PHP templates. 我的PHP模板之一中包含此代码。

// IF successful hide the form and show thanks

if (json.success) {
    $('#payment-form').hide();
    $('#thank-you').show();
}

If I would like to redirect to thank-you.php instead of showing #thank-you is it possible with this code or do I have to do something else? 如果我想重定向到thank-you.php而不是显示# thank-you.php ,那么此代码是否可行,还是我需要做其他事情?

You can redirect to new page by changing location.href property: 您可以通过更改location.href属性来重定向到新页面:

if (json.success) {
    location.href = '/thank-you.php';
}

Use this 用这个

if (json.success) {
   window.location.href = 'thank-you.php';
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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