Use ajax to verify whether an operation is performed on the front end.
jquery.post parameters are
url, [data], [callback], [type]
url: sending request address.
data: Key/value parameters to be sent.
callback: callback function when sending successfully.
type: Return content format, xml, html, script, json, text, _default.
$.post('admin/HhCheckVote.do?ids =' '${ids}', {}, function(flag) {
if(flag.isVote=="true"){
document.getElementById("jvForm").action="admin/HhArticleVoteCommit .do";
document.getElementById("jvForm").submit();
}else{
alert("You have already voted!");
}
}) ;
The action configuration in struts.xml is:
class="org.bkgd.ehome.jeeplugin.userapp.web.action.ActionHhArticleQuery">
Action
private String isVote;
public String getIsVote() {
return isVote;
}
public void setIsVote(String isVote) {
this.isVote = isVote;
}
public String checkVote(){
try {
List
PS:
The return value of the action method must be a global variable, and must have get and set methods. Local variables are not allowed.
The method has a return value and cannot be void.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn