var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
src: “”,
imageList: [],
countIndex: 3,//最多上传图片的数量
count: [1, 2, 3, 4, 5, 6, 7, 8, 9],
tip:’’,
user: ‘’,
p: ‘’,
title: ‘’,
content: ‘’,
},
/**
* 生命周期函数–监听页面加载
*/
onLoad: function (options) {
//接口调用示例
var that = this
//获取请求地址的url
var res_url = app.globalData.res_url;
//发起请求
wx.request({
//接口地址
url: res_url + ‘index.php?g=admin&m=wxxcx&a=release’,
method: ‘POST’,
//请求数据
data: {
id: ‘1’,
name: ‘ceshi’,
},
header: {
“Content-Type”: “application/x-www-form-urlencoded”
},
//成功后回调
success: function (res) {
console.log(res.data)
that.setData({
result: res.data
})
}
})
},
navbarTap: function (e) {
this.setData({
currentTab: e.currentTarget.dataset.idx
})
}
})
这是js里的数据;我想把data里的
user: '',
p: '',
title: '',
content: '',这几个数据传到后台。。。。请问代码怎么写呢????