Reputation: 183
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'
})
Upvotes: 0
Views: 2558
Reputation: 5588
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);
Upvotes: 1