@RequestMapping ( "saveUnionid" ) @ResponseBody public Integer saveUnionid(HttpServletRequest request,HttpServletResponse response){ //查询数据库是否有匹配记录 String openid = request.getParameter( "openid" ); String Phone = request.getParameter( "Phone" ); List<UserPo> list = userRepository.getListByPhone(Phone); if (list.size() > 0 ){ userRepository.updateUseropenid(openid,Phone); } return list.size(); } |
//前端js
function approvalSaveBtn() { var Phone = document.getElementById( "Phone" ).value; var openid = document.getElementById( "openid" ).value; $.ajax({ url : "${CtxPath}/storeadmin/biz/ou/user/saveUnionid.do" , type : "POST" , data : { Phone : Phone, openid : openid }, //dataType:"json", success : function (result) { alert(result); if (result == 0) { //alert(1); alert( "请核对手机号码" ); } else { alert( "绑定成功" ); WeixinJSBridge.call( 'closeWindow' ); } } }) } |
为什么手机端回调函数的result是html 文档,pc正常?求大神解答。
看样子是未登录后台接口重定向了
那应该怎么解决 ?
这是你们服务端的问题,找后台开发
我就是写后台的。。。。
一开始就是我写的全部代码
我用PC访问了一下你的接口,提示需要登录