$ajax json 對象傳springMVC接收

<script src="/js/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="/js/json2.js" type="text/javascript"></script>
     var arr = [];
     var data = {code:'code1', startDay:'2014-01-01', remark:'remark2'};
     arr.push(data);
alert(JSON.stringify(data));
alert(JSON.stringify(arr));
        $.ajax({
            type: "POST",
            contentType: "application/json;charset=utf-8",
            url: "${cpath}/attendancemanagement/kqHoliday/get",
            data: JSON.stringify(data),
            dataType: "json",
            complete: function () { },
            success: function (result) {
            },
            error: function (result, status) { }
        });



@ResponseBody
@RequestMapping(value = "/get", method = RequestMethod.POST)
public Map<String, Object> get(@RequestBody KqHoliday kqHoliday) {
Map<String, Object> result = new HashMap<String, Object>();
System.out.println(kqHoliday.toString());
result.put("message", "刪除成功!");
result.put("flag", Boolean.TRUE);
return result;
}
相關文章
相關標籤/搜索