这是我的表格:
<form id="login_form">
<table border="0">
<tr>
<td>username: </td>
<td colspan="10">
<input id="username" name="username" type="text" />
</td>
</tr>
<tr>
<td>password: </td>
<td>
<input id="passwd" name="passwd" type="password" />
</td>
</tr>
<tr style="text-align:center">
<td>
<input id="login_submit" type="submit" title="submit" />
</td>
<td>
<input type="reset" title="reset" />
</td>
</tr>
</table>
</form>
我的jQuery代码:
$(function(){
jQuery("#login_submit").click(function() {
jQuery.ajax({
url:'./login/',
type:'post',
data:$("#login_form").serialize(),
dataType:'html',
async: false,
success:function(backData) {
alert(data);
},
error:function(err){
alert('error = ' + err);
}
});
});
});
我感到困惑的是,当我访问 url: 时http://192.168.0.3/CarKeeperServer/user/login.jsp
,单击提交按钮(该页面不会定向到新页面,因为 jquery 代码片段中没有重定向代码),并且 url 将更改为http://192.168.0.3/CarKeeperServer/user/login.jsp?username=df&passwd=sd
,这是exposes
我的用户名和密码就像在GET
方法中一样。谁能解释为什么会发生这种情况以及解决方案是什么?非常感谢!