微信小程序开发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 //小程序关闭当前页面返回上一页面 }) }, })复制代码
复制代码 身份认证 登录密码 绑定手机 绑定邮箱 微信绑定
复制代码 当前头像: