1.验证表单不为空,输入项比较多的时候
var hashTable = { "Name": "名字",
"Id_card": "身份证", "PaySalary": "月工资",
"CardCode": "账号", "Fk_Subjectf_Code": "功能科目",
"Birthday": "出生日期", "Start_Date": "开始时间"
};
var y;
var result = true;
var value;
for (y in hashTable) {
value = $("#" + y).val();
if (value == "") {
alert(hashTable[y] + "不能为空!");
result = false;
break;
}
}
2. js 中转换成json格式时,如果包含bool类型,其值不加引号,其它的键/值都需要加引号.