This article will show you how to use the jquery load method for local refresh, the load method itself is very simple, but want to integrate into the jfinal and bootstrap public projects, we need to work harder.
First, I'll start with the plan.
$p. Load (url,data,function (RESPONSE,STATUS,XHR))
Then we need to provide at least two parameter URLs and jquery objects for the callback function of the AJAX request.
In addition, we may also have the possibility of an address bar overload.
So, we also need to provide a parameter.
So, we encapsulate three attributes
Locally loaded
String ElementID = Getpara ("ElementID");
String loadpage = Getpara ("LoadPage");
Address bar Jump Path
String locationurl = Getpara ("Locationurl");
SetAttr ("ElementID", ElementID);
SetAttr ("LoadPage", loadpage);
SetAttr ("Locationurl", Locationurl);
<a href= "${ctx}/mem/logout?elementid=log_tip&loadpage=header_login_tip"
<form class= "Pop_login_" Form "
action=" ${ctx}/mem/login?callbacktype=closecurrent&elementid=log_tip&loadpage=header_login_ Tip
Attention:
. The Jfinal end encapsulates three properties provided to the front end of the callback function.
. The corresponding parameters are passed to jfinal in the JSP
And then we're going to use
function Dialogajaxdone (JSON) {
yunm.ajaxdone (JSON);
if (json[yunm.keys.statuscode] = = YUNM.statusCode.ok | | json[yunm.keys.statuscode] = = YUNM.statusCode.info) {
if (" Closecurrent "= = Json.callbacktype) {
close_pop ();
}
if (json.locationurl) {
location.href = Json.locationurl;
} else {
//If a rear page is specified, turn
$ ("#" + Json.elementid). Load (Common.loadpath + json.loadpage + common.viewtype);}}
I offer a similar approach, mainly according to the program given in the title.
Pay attention.
To use the jquery load method, you must add all references to the corresponding page.
<! DOCTYPE HTML PUBLIC "-//wc//dtd HTML. transitional//en "" Http://www.w.org/TR/html/loose.dtd ">