load.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="../jquery-1.8.3.min.js"></script>
<script type="text/javascript">
function getServerResponse(){
$("#respone").load("../jsp/load.jsp");
}
</script>
</head>
<body>
<span id="respone"></span>
<button onclick ="getServerResponse()">get server response</button>
</body>
</html>
load.jsp
<%@ page contentType="text/html" import="java.io.*"%>
<%
PrintWriter pw = response.getWriter();
pw.print("Hello");
%>
Reference
jQuery - AJAX load() Method
沒有留言:
張貼留言