Moh*_*ari 3 laravel vue.js axios
Before everything, this is not duplicate.
How can i get my Axios parameters from URL for my GET request?
Example:
Link : http://127.0.0.1:8000/callback?Authority=000000000000000000000000000107041762&Status=OK
So parameters are Authority And Status
Authority: How to get this parameters from url
Status: How to get this parameters from url
我正在使用 laravel 和 vue.js,代码是:
回调.vue:
<template>
<div>
TEXT
</div>
</template>
<script>
export default {
name: "callback",
data () {
return {}
},
methods: {
loadData(){
axios.get("api/callback", {
Authority: ,
Status
})
.then(({ data }) => (
console.log(data)
));
},
},
created() {
this.loadData();
}
}
Run Code Online (Sandbox Code Playgroud)
控制器功能:
public function order(Request $request){
$MerchantID = 'xxxx';
$Authority =$request->get('Authority') ;
$Amount = 111 ;
if ($request->get('Status') == 'OK') {
$client = new nusoap_client('https://localhost/ices/WebGate/wsdl', 'wsdl');
$client->soap_defencoding = 'UTF-8';
$result = $client->call('PaymentVerification', [
[
'MerchantID' => $MerchantID,
'Authority' => $Authority,
'Amount' => $Amount,
],
]);
if ($result['Status'] == 100) {
return 'Done';
} else {
return 'Error 1';
}
}
else
{
return 'Error 2';
}
Run Code Online (Sandbox Code Playgroud)
您需要使用{params: {}}将 url 查询传递给axios.get
axios.get("api/callback", {
params: {
Authority: ''
Status: 'OK'
}
})
.then(({
data
}) => (
console.log(data)
));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6764 次 |
| 最近记录: |