研究了这一法典:
[WebMethod]
public static string GetFacilities(string id)
{
int hotelid = System.Convert.ToInt32(Tools.DecryptString(id));
string ret = "";
foreach (var item in new FacilityGroupBL().Load())
{
if(item.Facilities.Count != 0)
{
ret += "<fieldset>";
if (item.Facilities.Count() != 0)
{
foreach (var subitem in item.Facilities)
{
if (subitem.HotelFacilities.Where(obj => obj.HotelId == hotelid).Count() != 0)
ret += "<input type= checkbox checked= false />" + subitem.Name;
else
ret += "<input type= checkbox checked= true />" + subitem.Name;
}
}
else
{
ret += "There is no facility in this fieldset.";
ret += "</fieldset>";
}
}
}
return ret;
}
该法典将一些检查箱装入DIV,用户更换一些检查箱,并出版SAVE纽顿。 此时,即应将这些检查箱的数值发送给服务器,以更新我在数据库中的数据。 (一) 如何? 帮助
note: my default code for this probem is here but it does not work($("#FacilitiesDIV input[type=checkbox]").serializeArray() is empty)
$.ajax({
type: "POST",
url: "HotelsList.aspx/SaveFacilities",
data: "{ id : " + $("#HiddenField").val() + " , Facilities : " + $("#FacilitiesDIV input[type=checkbox]").serializeArray() + " }",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
},
error: function () {
$( #dialogMessage ).dialog( open );
$( #dialogMessage span ).html("Operation Error");
}
});