Html form method message doesn't work correctly on localhost

I recently set sails.js

up to act as a web server to host all my html files and other files and ran into a problem in my account. When the html form method is set to post, I am faced with a 404 error claiming it cannot find the file. However, when I change the method to a get method, it loads the corresponding html file with no problem (but displays the username and password in the url, yikes!). Even a stranger, when I type the file path (which is called by the post method) in a separate tab, the page loads without any problem.

The project I'm working on - this training project, so I could explore the inner workings of the Web page using js, jquery

, angularjs

, css

, html

and so on. All I want to do is have a login form to redirect me to a "logged in" page where all it says is "Login successfully". I don't have a list of registered users or something similar, I just want it to go to the next page! Here is the code;)

<form name="login" method="post" accept-charset="utf-8" action="../html/KLASSY_LOGGED_IN.html">
    <div class="line">
        <label for="username">Username</label>
        <input type="username" name="myUsername" id="username" pattern=".{6,}" placeholder="" ng-required="true">
    </div>
    <div class="line">
        <label for="password">Password</label>
        <input type="password" name="myPassword" id="pwd" pattern=".{8,}" placeholder="" ng-required="true">
    </div>
    <div class="line submit">
        <input type="submit" id="cusLogin" value="Login" />
    </div>
</form>

      

Every file I link to using "../" works great. In the link href attribute and script src attribute, this type of file link works fine. No server code. All I want to do is take me to the "logged in" page without the server code. It worked great outside sails.js

, but why not inside sails.js

?

+3


source to share


1 answer


You need the handler to be some type of script, you can't just point an action to that page.

../html/KLASSY_LOGGED_IN.html



What you can do is a javascript action that redirects you to this page.

+1


source







All Articles