首页 > Web开发 > 详细

jQuery 发送 ajax json 请求。。

时间:2019-04-08 22:00:11      阅读:135      评论:0      收藏:0      [点我收藏+]

$.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 请求。。

 

jQuery 发送 ajax json 请求。。

原文:https://www.cnblogs.com/whm-blog/p/10673733.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!