var _data={}; //定义全局变量
var code=$('#syscateId').val();
var txt = "";
var categoryVal=customTg.getCheckValue('category');
if(!!categoryVal){
txt+=categoryVal;
_data[code] = txt;
}
$('#categoryScopes').val(_json2str(_data)); //文本隐藏域赋值
//公用方法解析后台json 回值的object/List 的内容
function _json2str(o) {
var arr = [];
var fmt = function(s) {
if (typeof s == 'object' && s != null) return _json2str(s);
return /^(string|number)$/.test(typeof s) ? "'" + s + "'" : s;
};
for (var i in o) arr.push("'" + i + "':" + fmt(o[i]));
return '{' + arr.join(',') + '}';
}