这个组不成像下下面那样的对你数据,提示:
Uncaught TypeError: Cannot set property 'userid' of undefined index.html:127
(anonymous function)
不知道userid那里为什么错了
var data = {};
data['id'] = 'waiting' + Date.parse(new Date());
data['content'] = "禁止IOS系统下长按图片弹出图片保存菜单?";
data['inputtime'] = 0;
data['position'] = "22.5446,45.2544";
data['synchrotime'] = Date.parse(new Date());
data['myaddress'] = "广州中国人民银行";
data['showaddress'] = "true";
data.UserInfo['userid'] = "654df5d";
data.UserInfo['nickname'] = "好人";
data.UserInfo['age'] = "22";
data.UserInfo['sex'] = "true";
data.UserInfo['company'] = "华润万家";
data.UserInfo['avatar'] = "http://a6a9bb2b2535f09d119f.b0.upaiyun.com/apicloud/b2ab1120806d2f7f47cf502d4a9456fa.jpg";
data.DeviceInfo['system'] = "api.systemType";
data.DeviceInfo['vendor'] = "api.deviceName";
data.DeviceInfo['model'] = "api.deviceModel";
console.log(data);
var _data =
{
"id": "waiting1438771689000",
"content": "地垮台大",
"inputtime": 0,
"position": "22.546162,114.070908",
"description": "地垮台大",
"synchrotime": 1438771689000,
"showaddress": "0",
"UserInfo": {
"userid": "554cc3198ae6c423a43e0f",
"nickname": "88888888888",
"age": "5155",
"sex": "true",
"company": "奔奔娱乐有限公司",
"avatar": "http://a6a9bb2b2535f09d119f.b0.upaiyun.com/apicloud/b2ab1120806d2f7f47cf502d4a9456fa.jpg"
},
"DeviceInfo": {
"system": "android",
"model": "Droid4X",
"vendor": "MIT"
}
};
加data["UserInfo"]={}试试
data.UserInfo
和data.DeviceInfo
都还没有赋值呢这样就可以了