之前一直用ajax的$post方法请求api接口,那么遇到项目RESTful改造,那么应该怎么破呢?
莫慌,且用以下方法即可。
$.ajax({ url :"${basePath}queue/call/"+checkWindow+"/"+checkNumber+"/1", // 处理的请求路径 type : "put" , // 此处发送的是PUT请求(可变更为其他需要的请求) dataType : "json" , // 返回的数据类型为json类型 success : function(result) { //接收并处理返回结果 if(result.errorCode=="00"){ $("#returninfo").html("叫号成功!");getQueue(); }else{ $("#returninfo").html(result.errorMessage);getQueue() } } , error : function(data) { $("#returninfo").html("服务器异常!");getQueue(); } }) ;
如果本地没有jquery可以使用cdn
如对本文有疑问, 点击进行留言回复!!
offset、client、scroll (width,height、left,top、X,Y)
网友评论