1.GET请求
$.get("../../AjaxPostServlet",
{ name: "John", time: "2pm" },
function(data){
alert("success"+data);
}
);
2.POST请求
$.post("../../AjaxPostServlet",
{ name: "John", time: "2pm" },
function(data){
alert("success"+data);
}
);
3.Ajax请求
$.ajax({
type: "POST",
url: "../../AjaxPostServlet.action",
data: "name=John&location=Boston",
success: function(msg){
alert( "Data Saved: " + msg );
},
error:function(data){
alert( "error: " + data );
}
});