PDA

View Full Version : Form with no action



coolchris322
02-04-2011, 04:49 PM
I was looking on a site the other day and noticed it was using jQuery to load pages, like habbox and my site.

Now, within one of the pages, I noticed it had a login form, and to submit the form, they used this sort of code



<form action="" method="post">
Username: <input type="text" name="username"><br>
Password: <input type="text" name="password"><br>
<input type="submit" value="Submit">
</form>


And when you enter the information, it logs you in and validates you.
How the hell does it run the log in information and queries while not having a action?

Trinity
02-04-2011, 06:39 PM
A form with an empty action will submit to itself, e.g. a form on randompage.php without an action will use randompage.php as the action.
I'm not sure how the jQuery stuff is relevant to your question though.

Source
03-04-2011, 02:48 AM
Chances are they were using jQuery to null any action the form does, and instead add an event listener so when the form is submitted, javascript (jQuery) jumps in, processes the data and does a post AJAX request and then handles the results.

coolchris322
05-04-2011, 10:15 PM
Dont matter, im using jQuery $.post now.

Want to hide these adverts? Register an account for free!