后台:
aContext.getResponse().getWriter().println("" + result);
前端:
$.ajax({ ???????????url:encodeURI(encodeURI(url)), ???????????async :true, ???????????type:‘post‘, ???????????success:function(result) ???????????{ ???????????????if(result.indexOf("true")!=-1){//重点在这!!! ?????????????????alert(‘设置成功!‘); ???????????????}else{ ??????????????????alert(‘设置失败!‘); ???????????????} ????????????}, ???????????????error:function(xhr) ????????????{ ?????????????????alert("请求失败"); ????????????} ????????});
Ajax接收后台发送过来的布尔值以及指定的字符串
原文地址:https://www.cnblogs.com/jooy/p/8340876.html