原創(chuàng)聲明:本文為作者原創(chuàng),未經(jīng)允許不得轉(zhuǎn)載,經(jīng)授權(quán)轉(zhuǎn)載需注明作者和出處
java與后臺交互url怎么寫?
findDay: function (e) {
var that = this;
wx.request({
url: ‘https://localhost:8443/xiaochengxu/addBill.dovation?a=getPortalCate',//請求地址
data: {//發(fā)送給后臺的數(shù)據(jù)
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,為后臺返回的數(shù)據(jù)
that.setData({//如果在sucess直接寫this就變成了wx.request()的this了.必須為getdata函數(shù)的this,不然無法重置調(diào)用函數(shù)
logs: res.data.result
})
},
fail: function (err) {
console.log('submit fail');
},//請求失敗
complete: function () {
console.log('submit complete');
}//請求完成后執(zhí)行的函數(shù)
})
}
?????????????