87
rated 0 times
[
94]
[
7]
/ answers: 1 / hits: 176984
/ 12 Years ago, mon, september 3, 2012, 12:00:00
I'm attempting to use jQuery to capture a submit event and then send the form elements formatted as JSON to a PHP page.
I'm having issues capturing the submit though, I started with a .click()
event but moved to the .submit()
one instead.
I now have the following trimmed down code.
HTML
<form method=POST id=login_form>
<label>Username:</label>
<input type=text name=username id=username/>
<label>Password:</label>
<input type=password name=password id=password/>
<input type=submit value=Submit name=submit class=submit id=submit />
</form>
Javascript
$('#login_form').submit(function() {
var data = $(#login_form :input).serializeArray();
alert('Handler for .submit() called.');
});
More From » html