标签:
1、Json解析、POST
$.post("@Url.Action("EverbrightBankCity", "ContractPost")", { City: city, ApplyCode: ApplyCode }, function (data) { var json = eval(data); var optionStrCity = json.optionStrCity; var optionStrBank = json.optionStrBank; $("#City").html(optionStrCity); $("#CustodianBankName").html(optionStrBank); });
2、toJson (Json提交list对象)
function UpdateOrAddDocumentType(onSuccess) { var objArray = new Array(); $("#DetainDocument ul").each(function (i) { var obj = new Object(); obj.ApplyCode = "@Model[0].ApplyCode"; obj.OrderBY = parseInt(i + 1); obj.SignID = $(this).find("select").val(); obj.SignName = $(this).find("select").find("option:selected").text(); var SignDocumentID = ""; var SignDocumentName = ""; $(this).find(":checkbox").each(function (i) { if ($(this).attr("checked") == "checked") { SignDocumentID += $(this).val() + ","; SignDocumentName += $.trim($(this).parent().text()) + ","; } }); obj.SignDocumentID = SignDocumentID; obj.SignDocumentName = SignDocumentName; objArray.push(obj); }); var postData = $.toJSON(objArray); $.ajax({ async: "false", type: "POST", url: "@Url.Action("UpdateDocumentType", "ContractPost")", data: { postData: postData }, success: function (data) { if (data == "true") { onSuccess(); } else { alert("收押证件类型保存失败!"); } } }); }
标签:
原文地址:http://www.cnblogs.com/eric-gms/p/5594248.html