$.extend({ postJson: function (data) { data = data || {} $.ajax({ type: "POST", url: data.url, contentType: "application/json; charset=utf-8", data: JSON.stringify(data.data), success: function (resp) { data.success(resp) }, error: function (err) { data.error(err) } }) } })
data 參數示例 :
{ url: "/doIndex", data: {list: [this.form]}, success: function (resp) { alert("響應信息。"); }, error: function (message) { alert("未知的錯誤。。。。"); } }
后台如上圖所示。。 使用 @RequestBody 接受 整個 JSON 請求。。