A very novice level question:
In order to access Alipay’s instant payment interface, the example given in the demo is:
<form name=alipayment action=alipayapi.php method=post target="_blank">
<button class="new-btn-login" type="submit" style="text-align:center;">确 认</button>
</form>
I use the post() method of $http to submit a post request to alipayapi.php:
$scope.goPay=function(){
$http({
method : 'POST',
//url : 'php/submitOrder.php',
url : 'php/secback/alipay/alipayapi.php',
data : $.param({ 'oid' : $stateParams.oid,'checkmethod': $scope.checkmethod}),
headers : { 'Content-Type' : 'application/x-www-form-urlencoded' }
}).success(function(data) {
console.log(data);
});
};
alipayapi.php will actually splice an html that contains a form and will be automatically submitted. The problem is that the official demo will automatically jump to the Alipay gateway, but the post() method of $http will not jump....
Attached, console.log(data) information:
Actually, I think I just need a method that can execute the HTML that is returned later.... Direct eval() doesn't seem to work
PHP中文网2017-05-15 17:07:54
The form submitted by ajax POST cannot automatically jump, use form+new window
给我你的怀抱2017-05-15 17:07:54
Ajax returns the spliced url. When ajax returns success, use location.href=url to jump.
为情所困2017-05-15 17:07:54
To put it simply, this kind of demand is not easy to complete with ajax. Just open a new window to pay.