微信小程序开发POST请求
wx.request( {
url: "http://op.juhe.cn/onebox/weather/query",
header: {
"Content-Type": "application/x-www-form-urlencoded"
},
method: "POST",
//data: { cityname: "上海", key: "de" },
data: Util.json2Form( { cityname: "上海", key: "fddf" }),
complete: function( res ) {
}
})
复制代码
微信小程序示例
wx.request({
url: 'test.php', //仅为示例,并非真实的接口地址
data: {
x: '' ,
y: ''
},
header: {
'content-type': 'application/json'
},
success: function(res) {
console.log(res.data)
}
})
复制代码
method: 'POST',
header:{
'content-type':'application/x-www-form-urlencoded'
},
复制代码
onLoad: function() {
that = this;
wx.request( {
url: "url",
header: {
"Content-Type": "application/x-www-form-urlencoded"
},
method: "POST",
data: {},
complete: function( res ) {
console.log(res.data)
});
if( res == null || res.data == null ) {
console.error( '网络请求失败' );
return;
}
}
})
},
复制代码
data: Util.json2Form( { cityname: "北京", key: "1430ec127e097e1113259c5e1be1ba70" }),
复制代码
header: {"Content-Type":"application/x-www-form-urlencoded"},
复制代码
wx.request({
url : "https://www.",
method: "POST",
data: {
answer : JSON.stringify(this.data.answer),
pjid : this.data.pj.pjid,
testpaperid : this.data.pj.testpaperid,
student : JSON.stringify(this.data.student),
message : this.data.message
},
header: {
"Content-Type": "application/x-www-form-urlencoded"
},
success: function (res) {
console.log(res.data);
wx.navigateBack({
delta: 1 //小程序关闭当前页面返回上一页面
})
},
})
复制代码
'bg'>
'item'>
身份认证
'bk'>
'idCard' class="textarea" placeholder="{{detailanquan.idCard}}" value='{{detailanquan.idCard}}' bindinput="idCard" maxlength='15' auto-height/>
"line">
'item'>
登录密码
'bk'>
'password' class="textarea" placeholder="{{anquan.password}}" value='{{anquan.password}}' bindinput="password" maxlength='100' auto-height/>
"line">
'item'>
绑定手机
'bk'>
'phone' class="textarea" placeholder="{{anquan.phone}}" value='{{anquan.phone}}' bindinput="phone" maxlength='15' auto-height/>
"line">
'item'>
绑定邮箱
'bk'>
'email' class="textarea" placeholder="{{anquan.email}}" value='{{anquan.email}}' bindinput="email" maxlength='30' auto-height/>
"line">
'item'>
微信绑定
'bk'>
'wxUnionid' class="textarea" placeholder="{{anquan.wxUnionid}}" value='{{anquan.wxUnionid}}' bindinput="wxUnionid" maxlength='100' auto-height/>
"line">
复制代码
'bg'>
'item'>
当前头像:
type="userAvatarUrl" class='img'>
复制代码