0

I want to add a script tag inside paysucc.html if response.statusText == "OK". How is that possible?

script:

<script src="https://test.oppwa.com/v1/paymentWidgets.js?checkoutId={checkoutId}"></script>

Where checkoutId is response.data.id

Payment.html:

<button type="submit" class="btn-normal pay-btn" ng-click="processpartners()">Pay From Processing partners</button>

Controller.js:

$scope.processpartners = function() {
        var request = $http({
            method: 'POST',
            url: SITE_URL + '/api/processpartners',
            data: {
                amount: $scope.amount,
                currency: $scope.currency,
            },
        }).then(function(response) {                       
            if ((response.statusText == "OK") && (response.status == 200)) {
                $location.path(SITE_URL + '/paysucc', response.data.id).replace();
            }
        });
    };

routes.js:

 when(SITE_URL + '/paysucc', {
        templateUrl: TEMPLATE_URL + '/partials/paysucc.html',
        controller: 'PaymentsuccessController'
    })
1

1 Answer 1

1

Please, try this solution may it's help you:

var s = document.createElement("script");
s.type = "text/javascript";
s.src = "http://somedomain.com/somescript";
$("head").append(s);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.