原創聲明:本文為作者原創,未經允許不得轉載,經授權轉載需注明作者和出處
java與后臺交互url怎么寫?
findDay: function (e) {
var that = this;
wx.request({
url: ‘https://localhost:8443/xiaochengxu/addBill.dovation?a=getPortalCate',//請求地址
data: {//發送給后臺的數據
name: “bella”,
age: 20,
password:”jiazongrong”
},
header: {//請求頭
“Content-Type”: “applciation/json”
},
method: “GET”,//get為默認方法/POST
success: function (res) {
console.log(res.data);//res.data相當于ajax里面的data,為后臺返回的數據
that.setData({//如果在sucess直接寫this就變成了wx.request()的this了.必須為getdata函數的this,不然無法重置調用函數
logs: res.data.result
})
},
fail: function (err) {
console.log('submit fail');
},//請求失敗
complete: function () {
console.log('submit complete');
}//請求完成后執行的函數
})
}
?????????????