On a front-end page, parameters need to be submitted through JavaScript. Use JS to create a form and append the parameters to the form for submission. The code is as follows:
Js code:
functionloadConfig(gameUrl,skinId){
vartemp=document.createElement("form" );
temp.action="${createLink(controller:'mobileConfig',action:'beforeLaunchConfig')}";
temp.method="POST";
temp.style.visibility=" hidden";
varopt=document.createElement("input");
opt.name="gameUrl";
opt.id="gameUrl";
opt.value=gameUrl;
varopt2=document.createElement("input");
opt2.name="skinId";
opt2.id="skinId";
opt2.value=skinId;
temp.appendChild( opt);
temp.appendChild(opt2);
temp.submit();
}
This function can run successfully on Chrome and Safari, but when using FireFox (17.0.1) cannot be submitted successfully. After research, it is found that FireFox requires the page to have complete tag items when submitting the page form, that is,
A tag structure like head>
. Therefore, small changes were made to this JS:
Js code:
functionloadConfig(gameUrl,skinId){
varpageDiv=document.getElementById("page");
vartemp=document.createElement("form");
temp.action="${createLink(controller:'mobileConfig',action:'beforeLaunchConfig')}";
temp.method="POST";
temp.style.visibility="hidden";
temp.name="loadConfigPage";
varopt=document.createElement("input");
opt.name="gameUrl";
opt.id="gameUrl";
opt. value=gameUrl;
varopt2=document.createElement("input");
opt2.name="skinId";
opt2.id="skinId";
opt2.value=skinId;
temp.appendChild(opt);
temp.appendChild(opt2);
pageDiv.appendChild(temp);
temp.submit();
}
Append the form created here in the tag, and then submit it successfully.