$.ajax({
url:baselocation+"/admin/website/delWebsiteInstitution",
type:"post",
data:{"instIds":instIds},
dataType:"json",
success:function(result){
if(result.message){
alert("删除成功");
window.location.reload();
}
}
});
每次执行到第一行时就直接跳出 不报任何错误
检查下有没有网络请求 然后看下是不是跨域了
是进入success后的第一行么?那就是result逻辑运算的值为false
如果是$.ajax后面不执行,是不是你没有写error 后台返回的是error所以你捕获不到,你写上error接受下,
再有就是在调试器上查看network选项卡
你发送ajax请求后会有你传递的参数和返回结果,在header和response中
这问题好难答,线索略少。那就根据现在能看到的东西,谈几点问题吧:
根据jquery官网文档,
method
描述如下:
The HTTP method to use for the request (e.g. "POST", "GET", "PUT")
你是小写post
。文档里没说大小写无所谓哦!
根据jquery官网文档,
data
描述如下:
Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests
你确定你是希望你的ajax
call是以xxx/admin/website/delWebsiteInstitution?instIds=yy
这种方式发送么?
加
error: function(xhr) {console.log(xhr.responseText);}
调试嘛