日期:2014-05-16 浏览次数:20749 次
<script type='text/javascript' src='js/jquery-1.4.4.js'></script>
<script type='text/javascript'>
var username;
var password;
$(document).ready(function() {
$.ajax( {
type : "POST",
url : "/login",
data : "name="+username+"&password="+password",
success : function(msg) {
alert("url hasPost!");
}
});
});
formSubmit(){
}
</script>
<body>
<form action="/login" method="post">
nausername:<input type="text" name="name" id="name" /><br/>
password:<input type="password" name="password" id="password"/><br/>
<input type="submit" value="提交"><input type="reset" value="重置"/>
</form>
</body>
<script type="text/javascript" src="js/jquery-1.4.4.js"></script>
<script type="text/javascript">
$(function(){
$(":input[type=button]").click(function(){
var $params="username="+$("#name").val()+"&password="+$("#password").val();
$.ajax({
type : "POST",
url: "TestAjaxServlet",
data: $params,
success: function(msg){
alert(msg);
}
});
});
})
</script>
</head>
<body>
<form action="" method="post">
nausername:<input type="text" name="name" id="name" /><br/>
password:<input type="password" name="password" id="password"/><br/>
&nb