Js-Ajax
jQuery Ajax
1 ajax
$.ajax({ type: 'POST',//请求方式 GET/POST url: "/api/jsonws/cch-portlet.scorestatisticshelper/list-exam-score",//url地址 async: false, data: { "id": id, "password": password, "role_id": role_id },//传给后端的参数 dataType: 'json',//返回数据的类型 text/json/html success: function (res) {//回调函数 res:后台返回的数据 getPlanName(res.datas); } });
2 POST
post:
$.post() 方法使用 HTTP POST 请求从服务器加载数据。
语法 $.post(URL,data,function(data,status,xhr),dataType)
1.第一种写法
var url = "/api/jsonws/cch-portlet.scorestatisticshelper/list-exam-score" var data = { id:id, password,password } $.post(url,data,function(res){ getPlanName(res.datas); },"json");
2.第二种写法
var url = "/api/jsonws/cch-portlet.scorestatisticshelper/list-exam-score" var data = { id:id, password,password, } $.post(url,data).then(function(res){ getPlanName(res.datas); });
3 GET
get:
$.get() 方法使用 HTTP GET 请求从服务器加载数据。
语法:$.get(url,data,function(data,status,xhr),dataType)
var url = "/api/jsonws/cch-portlet.scorestatisticshelper/list-exam-score" var data = { id:id, password,password } $.get(url,data,function(res){ getPlanName(res.datas); },"json");
岁月如歌,,,
本文作者:千夜ん
本文链接:https://www.cnblogs.com/fengpeng123/p/16800759.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步