Recently, I found a colleague who wrote a piece of code (on the Import.jsp) page to write the following code:
<%
String action=request.getparameter ("action");
%>
<%
Pagemenustr + = "{E," + "import" + ", Javascript:onimp ();}";
%>
<div id= "Pagemenubar" style= "z-index:100;" ></div>
<%@ include file= "/vbase/pagemenu.jsp"%>
var i=0;
function Onimp () {
i++;
Jquery.get ("import.jsp", {action: "Imp", I: "I"},function (data) {
});
if (j==0) {
Alert ("In the import, please wait!");
Return
}
i=0;
Alert ("In the import, please wait!");
CheckStatus ();
}
}
Here Pagemenustr is the code used to generate the button.
Each time the system reboots, the first run of this method, can take out the value of the action is imp, and after many clicks on the button, the action value has become null.
And I changed the code to:
function Onimp () {
i++;
Jquery.post ("import.jsp", {action: "Imp", I: "I"},function (data) {
});
if (j==0) {
Alert ("In the import, please wait!");
Return
}
i=0;
Alert ("In the import, please wait!");
CheckStatus ();
}
After the Get method is changed to the Post method, the action can correctly value imp no matter how many times the button is clicked.
Here's a little detail:
Is the problem of using the I variable.
Cause I found it. Please see my another article on the difference between get and post.