a.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready( function() {
$('#btn').click( function() {
$('#img').attr('src',"images/AD_01.jpg");
$.post('process.jsp', {
text: 'my string',
number: 23},
function(data) {
//alert(data);
$('#img').attr('src',"images/AD_02.jpg");
$('#loading').html(data)
}
);
});
});
</script>
</head>
<body>
<input type="button" id="btn" value="Test">
<br />
<span id="loading"> Loading.... </span>
<img id="img" src="images/btn_next.gif"/>
</body>
</html>
b.jsp
<%
String value=request.getParameter("text");
out.println(value+"Hello");
Thread.currentThread().sleep(1000);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready( function() {
$('#btn').click( function() {
$('#img').attr('src',"images/AD_01.jpg");
$.post('process.jsp', {
text: 'my string',
number: 23},
function(data) {
//alert(data);
$('#img').attr('src',"images/AD_02.jpg");
$('#loading').html(data)
}
);
});
});
</script>
</head>
<body>
<input type="button" id="btn" value="Test">
<br />
<span id="loading"> Loading.... </span>
<img id="img" src="images/btn_next.gif"/>
</body>
</html>
b.jsp
<%
String value=request.getParameter("text");
out.println(value+"Hello");
Thread.currentThread().sleep(1000);
%>