人总要为自己的错误买单
当使用window.location.href=”“传参数的时候,比如定义一个
var str;
window.location.href="*Controller.do?*&参数=str";
这样传递参数是错误的,只会把str识别成字符串。正确的应该是
window.location.href="*Controller.do?*&参数="+str+"";
上述错误也解释了为什么有的时候window.location.href会造成执行两次的错觉。代码规范真的很重要。