angular.js - angularjs $http.post does not jump after
ringa_lee
ringa_lee 2017-05-15 17:05:54
0
3
744

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

ringa_lee
ringa_lee

ringa_lee

reply all(3)
Ty80

The form submitted by ajax POST cannot automatically jump, use form+new window

给我你的怀抱

Ajax returns the spliced ​​url. When ajax returns success, use location.href=url to jump.

为情所困

To put it simply, this kind of demand is not easy to complete with ajax. Just open a new window to pay.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template