POST
function _post(url, data, success, fail) { wx.request({ url: http +url, header: { ‘content-type‘: ‘application/x-www-form-urlencoded‘, }, method: ‘POST‘, data: data, success: function (res) { success(res); }, fail: function (res) { fail(res); } }); }
请求写法
http._post(‘XX/XX/XX‘,{DATA},function(res){},function(res){})
GET
function _get(url, success, fail) { wx.request({ url: myHttps+url, header: { ‘Content-Type‘: ‘application/json‘ }, success: function (res) { success(res); }, fail: function (res) { fail(res); } }); }
请求写法
http._get(‘XX/X/XX?id=id‘,function(res){},function(res){})
时间: 2024-10-10 11:19:53