我正在构建自定义付款网关,该网关将通过ajax处理付款。它可以正常工作,但是持续1秒钟却显示错误显示并重定向到下一页。
<script>
jQuery.ajax({
type : "POST",
url:http://example.com
data: response,
dataType : "json",
cache: false,
success: function(response) {
window.location = response.redirect; // order view page
}
});
</script>
答案 0 :(得分:0)
您尝试使用JSON.parse(response);
吗?
<script>
jQuery.ajax({
type : "POST",
url:http://example.com
data: response,
dataType : "json",
cache: false,
success: function(response) {
var responseObj = JSON.parse(response);
window.location = responseObj.redirect; // order view page
}
});
</script>