1)
在js中使用$.post来调用controller中的方法时没有收到返回值
原因: 忘记在方法上加@ResponseBody来将返回值封装为json
2)
js中使用调用controller中的方法的返回值时, 由于返回值对象比较复杂, 并且在编写js时ide没有良好的对象成员提示, 使得写错了返回值对象的成员变量.
将exposer['exposed']写成了exposer['exposer']
编译器没有提示, 程序运行结果表现为死循环, 原因在于进入了错误的if else分支.
这是比较隐晦的bug, 需要十分熟悉代码逻辑才能debug.
3)
在使用<span>标签时, 将<span></span>简化为<span/>, 导致在编写js改变页面值的时候, 产生了奇怪的hide()错误.
<span id="killPhoneMessage" class="glyphicon"></span>
<button type="button" id="killPhoneBtn" class="btn btn-success"> <span class="glyphicon glyphicon-phone"></span>submit </button>
在这段代码中, 如果在#killPhoneMessage处使用<span/>, 那么hide()方法会将<button>标签一起隐藏掉.$('#killPhoneMessage').hide().html('<label class="label label-danger">手机号错误!</label>').show(300);