<script type= "Text/javascript" >
function Ajax () {
Ajaxsubmit (' detailform ', ' detail ', ' submit ', ' detailform ');
Ajaxsubmit (' Catalogid ', ' Search ', ' change ', ' articleform ');
function Setflag (flag) {
document.getElementById ("Articleparambean.flag"). Value=flag;
}
}
</script>
<body onload= "Ajax ()" >
<s:form action= "articlesearch.do" method= "post" id= "Articleform" >
<div id= "Search" >
<%@ include file= "articlesearch.jsp"%>
</div>
<s:hidden name= "Articleparambean.flag" ></s:hidden>
</s:form>
<s:form action= "articledetailsearch.do" method= "post" id= "Detailform" >
<div style= "width:99%" id= "Detail" >
<%@ include file= "articlelist.jsp"%>
</div>
</s:form>
<script type= "Text/javascript" >
$ (' Articleform '). Set (' send ', {
Onsuccess:function (response) {
if (document.getElementById ("Articleparambean.flag"). value== ' Search ') {
$ (' detail '). InnerHTML = response; Page Write back
}else{
$ (' search '). InnerHTML = response;
}},
Onfailure:function () {$ (' search '). Set (' Text ', ' the request failed. ');}
}
). Addevent (' Submit ', function (event)
{Event.preventdefault ();
This.send ();
}
);
</script>
</body>
The principle of MooTools asynchronous submission:
Divide the page into sections, submit them in different form, and write different areas of the page according to the submitted form.