对于JQuery的Ajax我只会用get方法
格式:$.get(url, [data],[callback],[type]);
url:请求的URL地址
data:发送到服务器的数据key/value(可选)
callback:回调函数(可选)
type:返回内容格式(可选)
具体事例:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>goof</title>
<script language="javascript" src="js/jquery-1.3.2.js"></script>
<script language="javascript">
var url = "get.jsp"
$(document).ready(function(){
$.get(url, {userName:"yufan",password:"123"}, function(data,testStatus){
//alert(data);
$("#show").html(data);
//alert(testStatus);
});
});
</script>
</head>
<body>
.........
<div id="show">woqu</div>
</body>
</html>
-------------------------------
get.jsp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
String yun = request.getParameter("userName");
%>
hello!
<%=yun %>
</body>
</html>