-1

I want to send a popup to a user if the user is not logged into my forum.

So far it works as far as appending the HTMl form to the new window created in Javascript; however, when I press the actual submit forms via the new window I get the basic 404 even though I use absolute URLs.

Here's the basic Javascript:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
     var myWindow = window.open("", "MsgWindow", "width=500, height=500");
myWindow.document.write('<h1>Already have an account? Login here!</h1><br> <form method="post" action="sportsboard.netai.net/page.php?page=login&&do=login&&formdisplay=false"> <label for="username">Username:</label><input type="text" id="username" name="username" size="35"><br> <label for="password">Password:</label> <input type="password" name="password" id="password" size="35"><br> <input type="submit" name="login" value="Login &gg;"> </form> <hr><br> <h1> or Signup and get started talking!</h1> <form method="post" action="sportsboard.netai.net/page.php?page=register&&do=register&&formdisplay=false"> <label for="username">Username:</label><input type="text" id="username" name="username" size="35"><br> <label for="password">Password:</label> <input type="password" name="password" id="password" size="35"><br> <label for="email">E-mail: &nbsp;&nbsp;&nbsp;&nbsp;</label> <input type="email" name="email" id="email" size="35"><br> <input type="submit" name="register" value="Register &gg;"> </form>');
});</script>

...and here's a basic link to a test page http://www.sportsboard.netai.net/Scripts/login.php?test=yes

If you press the submit buttons on there you'll be redirected to my testing free host's 404 page not found.

How do I make the form submit as if it were on a regular page?

Andrew Hendrie
  • 6,205
  • 4
  • 40
  • 71

2 Answers2

0

My guess would be you are using absolute urls incorrectly. Since, you didn't prefix your form post action with http://www. it is attempting to post it to the local relative path. Try this:

action="http://www.sportsboard.netai.net/page.php?page=register&&do=register&&formdisplay=false"
sctskw
  • 1,588
  • 1
  • 12
  • 14
0

The answer is as sctskw said! The action tried to search for the URL locally, so I added the http://www. to correctly direct the URL.