1、window.location.href
var json=JSON.parse(resp);
get方式:window.location.href="knowledgemanagesys.jsp?userName="+json["name"]+"&userId="+userId+"&authorizations="+json["authorizations"];
post方式:window.location.href= "javascript:$.post('knowledgemanagesys.jsp',{userName:json["name"],userId:userId,authorizations:json["authorizations"]})";
以上写法的缺点,会在url中暴露参数,解决办法如下
document.write("<form action=knowledgemanagesys.jsp method=post name=form style='display:none'>");
document.write("<input type=hidden name=userId value='"+userId+"'>");
document.write("<input type=hidden name=userName value='"+json["name"]+"'>");
document.write("<input type=hidden name=authorizations value='"+json["authorizations"]+"'>");
document.write("</form>");
document.form.submit();