码迷,mamicode.com
首页 > Web开发 > 详细

数据转换成json传递

时间:2016-06-25 16:25:18      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:

//将奖励转换成json格式
_page.StrRewardToJson = function () {

var hdReward = $("#hdReward").find("option:selected").text();
var ltReward = $("#ltReward").find("option:selected").text();
var dxReward = $("#dxReward").find("option:selected").text();

var yd = "[{\"isChecked\":" + chkyd.checked +",\"carrierId\":\"1\",\"dataPlanSize\":\""+hdReward+"\"}";
var lt = "{\"isChecked\":" + chklt.checked +",\"carrierId\":\"2\",\"dataPlanSize\":\""+ltReward+"\"}";
var dx = "{\"isChecked\":" + chkdx.checked + ",\"carrierId\":\"3\",\"dataPlanSize\":\"" + dxReward + "\"}]";
var obj = yd +","+lt+"," + dx;
$("#rewardName").val(obj);
$("#localName").val($("#local").find("option:selected").text());//给入口名称赋值
var n = $("#form1").serialize();
console.log(n);
return n;
}

数据转换成json传递

标签:

原文地址:http://www.cnblogs.com/xy0710/p/5616471.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!