js:
<script type="text/javascript">
$("a[id=submit]").click(function(){
var obj = {};
$("tr",navTab.getCurrentPanel()).each(function(){
var id = $("input[name=id]",this).val();
var type = $("select[name=expiryStatus]",this).val();
obj[id]=type;
});
var date={list:JSON.stringify(obj)};
var url="serviceFailureEquipmentsAction_updateType.action";
$.post(url,date,function(date){
DWZ.ajaxDone(date);
if (date.statusCode == DWZ.statusCode.ok){
alertMsg.correct(date.message);
}else{
alertMsg.error(date.message);
}
},"json");
});
</script>
action:
public String updateType(){
String list=ServletActionContext.getRequest().getParameter("list");
//JSONArray json = JSONArray.fromObject(list);
JSONObject object=JSONObject.fromObject(list);
Set<String> keys=object.keySet();{
for(String key:keys){
String value=object.getString(key);
serviceFailureEquipmentsService.update(Integer.parseInt(key), Integer.parseInt(value));
}
}
getobject("200", "質保修改成功", null, null, "sucess", null);
return null;
}