2016-08-01 44 views
1

表單提交到頁面後,重定向到支付網關頁面 成功或失敗後,頁面將重定向到相應的頁面,如 /或成功/失敗如何消除角度客戶端中的「訪問控制 - 允許來源?」

腳本

$http({ 
      url: "https://secure.payu.in/_payment", 
      method: "GET", 
      }).success(function(data, status, headers, config) { 
       console.log(data) 
       console.log(status) 
      }).error(function(data, status, headers, config) { 
        $scope.status = status; 
        console.log(status) 
      }); 
$scope.payemntProceed=function(checkout){ 
$scope.payment.txnid=Math.floor(100000000000+(Math.random()*900000000000)); 
$scope.payment.salt="HseUIoSb" 
$scope.payment.key="WHlKGc"; 
$scope.payment.amount=1; 
$scope.payment.productinfo=$rootScope.cartlist 
$scope.payment.firstname=$rootScope.userinfo.name; 
$scope.payment.email=$rootScope.userinfo.email 
$scope.payment.phone=$rootScope.userinfo.contactno; 
$scope.payment.surl="http://localhost/august1stZustshop/#/home" 
$scope.payment.furl="http://localhost/august1stZustshop/#/checkout" 
$scope.payment.service_provider="payu_paisa" 
var string = $scope.payment.key + '|' + $scope.payment.txnid + '|' + $scope.payment.amount + '|' + $scope.payment.productinfo + '|' + $scope.payment.firstname + '|' + $scope.payment.email + '|||||||||||' + $scope.payment.salt; 
$scope.payment.hash = $scope.SHA512(string); 
} 

控制檯這樣表示:

XMLHttpRequest cannot load https://secure.payu.in/_payment. 
No 'Access- Control-Allow-Origin' header is present on the requested resource. 
Origin 'http://localhost' is therefore not allowed access. 
status is -1. 

它總是執行失敗代碼。顯示狀態爲-1。

form.html

<form action="https://secure.payu.in/_payment" method="post" ng-submit="payemntProceed(checkout)"> 
<input type="text" ng-model="payment.txnid" name="txnid" > 
<input type="text" ng-model="payment.key" name="key" > 
<input type="text" ng-model="payment.amount" name="amount" >  
<input type="text" ng-model="payment.productinfo" name="productinfo" > 
<input type="text" ng-model="payment.firstname" name="firstname" > 
<input type="text" ng-model="payment.email" name="email" > 
<input type="text" ng-model="payment.phone" name="phone" >   
<input type="text" ng-model="payment.hash" name="hash" > 
<input type="text" ng-model="payment.surl" name="surl" > 
<input type="text" ng-model="payment.furl" name="furl"> 
<input type="text" ng-model="payment.service_provider" name="service_provider"> 
<button type="submit">submit</button> 

請告訴我如何刪除跨域的疑難問題。現在用的是payu錢支付網關。

回答

0

在仍然發出請求的同時停止來自客戶端的XHR跨源錯誤的唯一方法是不使用XHR。

擺脫調用$http並正常提交表單的JavaScript。

+0

請提供文章或鏈接。 – SrinivasAppQube

+0

@SrinivasAppQube - 爲什麼你需要一篇文章才能停止你已經完成的工作? – Quentin

+0

我正在使用正常提交頁面無法重定向到支付網關? – SrinivasAppQube

相關問題