JSP jumps to the code-behind page. There are several methods, for example,:
Action mode;
jquery way, code as below:
function Regcust () {
$ (' #containerFRM '). Form (
' Submit ',
{
"url": "${webappurl}/cust/registereduser.html",
Onsubmit:function () {
Show Matte
$.jbox.tip ("Submitting ...", ' loading ');
},
Success:function (responsetext) {
$.jbox.closetip ();
If (' success ' = = ResponseText) {
/*$.jbox.tip ("Registration successful, 3 seconds after their own initiative to jump ...", ' success ');
Window.settimeout (function () {
Window.location.href = document.getElementById (' Strbackurl '). Value
}, 3000); */
$ ('. Themsmain '). HTML ("<div style= ' height:100px;margin-top:50px;text-align:center;font-weight:bold;font-size: 16px;line-height:36px; ' ><span class= ' red bold font16 ' > Congratulations, Register success!
</span><br/> System <span id= ' Time_span ' >3</span> seconds after their own initiative to jump ...<div><div> ");
Window.opener.location.reload ();
Intervalobj = Window.setinterval (settime, 1000);
}else{
$.jbox.error (' register failed ', ' hint ');
}
}
}, ' text ');
}
Ajax Way. Now for the AJAX approach, the code is as follows:
$.ajax ({
URL: "${webappurl}/cust/existsuser.html?user_sn=" +s,
Type: "Post",
DataType: "Text",
ContentType: "Application/text;charset=utf-8",
Cache:false,
Async:false,
Success:function (data) {
if (' false ' = = Data | |!data)
{
Regcust ();
}else{
$.jbox.info (' username already exists, please enter ' again ', ' hint ');
}
}
}, ' text ');
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
JSP Jump back code page easy Way ~