<%@ page language="java" pageEncoding="UTF-8"%>
<html>
<head>
<title>My JSP 'test.jsp' starting page</title>
<mce:script type="text/javascript" src="js/jquery14.js" mce_src="js/jquery14.js"></mce:script>
<mce:script type="text/javascript"><!--
$(document).ready(
function()
{
$("#load").click(
function()
{
//$("#target").load('/Struts2Test/test/load.action');
$.ajax(
{
url:'/Struts2Test/test/load.action',
type:"post",
async:true,
data:{'userId':'kkkk', 'password':'jjjj'},
dataType:"html",
timeout:"1000",
error:function(){alert("服务加载出错");},
success:function(data)
{
alert(data);
$("#target").html(data);
alert("服务加载成功");
}
}
);
/*
$("#target").load(
'/Struts2Test/test/load.action',
{'userId':'kkkk', 'password':'jjjj'},
function(data)
{
alert(data);
$("#target").html(data);
}
);*/
/*
$.post(
'/Struts2Test/test/load.action',
{'userId':'kkkk', 'password':'jjjj'},
function(data)
{
alert(data);
$("#target").html(data);
}
);
*/
return false;
}
);
}
);
// --></mce:script>
</head>
<body>
<input type="button" id="load"/>
<div id="target"></div>
</body>
</html>