Scenario: Assuming the address of the current browser address bar is: http://localhost:8888/SSHBoot/tourist/homeMainAction_signInUI.do,
Now I want to locate the address "http://localhost:8888/SSHBoot/member/adminMainAction_mainUI.do" When I click the button.
The following JS code is no problem, put the JS script on the page
<HTML><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"><title>Bootstrap Learning</title></Head><Body> <inputID= "Btnsubmit"class= "btn btn-success btn-block btn-lg"type= "button"value= "Tap"> <Scripttype= "Text/javascript"src= "${basepath}/js/homemainaction/signinui.js"CHARSET= "Utf-8"></Script>
<script type= "Text/javascript" >
$ (function ($) {
Login Click
$ ("#btnSubmit"). Click (function () {
Window.location.href = "Http://localhost:8888/SSHBoot/member/adminMainAction_mainUI.do";
});
});
</script>
</Body></HTML>
However, if I extract the above JS script to be placed in the "signinui.js" file, as follows. This approach does not achieve the desired effect:
The address in the browser address bar is: http://localhost:8888/SSHBoot/tourist/http://localhost:8888/member/index.jsp
<HTML><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"><title>Bootstrap Learning</title></Head><Body> <inputID= "Btnsubmit"class= "btn btn-success btn-block btn-lg"type= "button"value= "Tap"> <Scripttype= "Text/javascript"src= "${basepath}/js/homemainaction/signinui.js"CHARSET= "Utf-8"></Script> </Body></HTML>
signinui.js:
$ (function($) { // Login Click $ ("#btnSubmit"). Click (function( { = "http://localhost:8888/SSHBoot/member/adminMainAction_mainUI.do";}); });
The following path styles should be used at this time:
$ (function($) { // Login Click $ ("#btnSubmit"). Click ( function() { = ": /member/adminmainaction_mainui.do "; }); });
Window.location.href when you put it in a separate JS file.