微信小程序的request数据请求

时间:2021-11-28 00:11:21

微信小程序request请求

get方法:

wx . request ({
url : http_host + '/home/good/' + id + '/edit' ,
method : 'GET' ,
header : {
"Content-Type" : "application/x-www-form-urlencoded"
},
success : function ( res ) {
console . log ( 'banner' , res . data );
that . setData ({
good_message : res . data . good ,
product_detail : res . data . detali ,
product_list : res . data ,
pro_msg : res . data . detali ,
pro_pos : res . data . guige
})
}
})

post方法:

wx . request ({
url : http_host + '/home/share' ,
method : 'post' ,
header : {
"Content-Type" : "application/x-www-form-urlencoded"
},
data : {
要post的数据
},
success : function ( res ) {
console . log ( '提交成功' , res )
}
})