日期:2014-05-16 浏览次数:21042 次
<package name="bs" namespace="" extends="struts-default">
<action name="PostList" class="org.erif.action.PostListAction">
<result name="success">/BBS/postlist.jsp</result>
</action>
</package>
<s:form action="PostList.action" >
<s:textfield name="type"></s:textfield>
<s:submit></s:submit>
</s:form>
$('#btnList').click(function() {
alert("tips");
//方式一:
//$.post('PostList.action');
//方式二:
$.ajax({
url : 'PostList.action',
type : 'post' ,
dataType : 'text',
//data : params,
success : function(){
alert("OK");
},
error : function(XmlHttpRequest, textStatus, errorThrown) {
alert(XmlHttpRequest.status);
if (XmlHttpRequest.status == 200) {
var errorstr = XmlHttpRequest.responseText;
alert(errorstr);
}
}
});
});
$.ajax({
url : 'PostList.action',
type : 'post' ,
dataType : 'text',
//data : params,
success : function(){
alert("OK");
window.location='/BBS/postlist.jsp'//////////
},
error : function(XmlHttpRequest, textStatus, errorThrown) {
alert(XmlHttpRequest.status);
if (XmlHttpRequest.status == 200) {
var errorstr = XmlHttpRequest.responseText;
alert(errorstr);
}
}
});