【发布时间】:2015-10-04 16:00:50
【问题描述】:
我有 HTML AngualrJS 应用程序,其工作方式如下:
- 用户在表单上输入支付信息,表单没有设置动作属性
- 用户点击提交
- AngularJS 拦截数据、处理支付并向服务器发送请求。
这是控制器从我的 PHP 接收交易确认详细信息的地方:
this.stripeResponseHandler = function (status, response) {
...
$http ({
method: 'POST',
url: 'https://server/billpay/charge.php',
data: postData
}).then (function (response) {
console.log (response.data);
that.result = response.data;
that.isSaving=1;
}, function (response) {
console.log ("failed %s", response);
that.isSaving=1;
})
问题:
我需要将整个现有页面(带有表单)替换为服务器返回的完整 HTML 页面(带有 CSS、HTML、JS)。
服务器返回用户可以打印的收据作为记录。
基本上我不想只在当前页面上注入服务器对 DIV(或类似)的响应,而是需要从服务器响应中重新呈现整个新页面。
我该怎么做?
谢谢!!
【问题讨论】:
-
你可以做到,但听起来不是个好主意。考虑重定向到新页面。
标签: javascript html angularjs stripe-payments