扫码关注官方订阅号
jquery发送ajax请求,参数怎么放到http请求的body里面
光阴似箭催人老,日月如移越少年。
$.ajax({ url: "http://wiki.shajiquan.com/gitit-bigger" type: "post", dataType: "json", data: "hello world", headers: {'Content-Type': 'application/json'}, success: function (res) { if (res.status == 1) { window.location.reload(); } else { alert(res.message); } } })
这里的 data 就会在 body 体中。
data
使用POST请求就会数据放在请求的body体中
使用jQuery提供的 $.post:
$.post("your service url",{ param1 : 1, param2 : "tom", },function(response){ // 处理返回 });
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
这里的
data就会在 body 体中。使用POST请求就会数据放在请求的body体中
使用jQuery提供的 $.post: