I am VERY new to Jquery programming and I really need y’alls help…
I am trying to use the following script to update a page without refreshing if there is a login error :
$(function(){
$("#log").submit(function(){
dataString = $("#log").serialize();
$.ajax({
type: "POST",
url: "maintenance.php",
data: dataString,
dataType: "json",
success: function(data)
{
$("#log_area").html("Username Password Combination was not found");
}
});
return false;
});
});
Here’s a form that I have:
<form id="log">
<label for="username">Username:</label><br/>
<input type="username" name="username" id="username" /><br/>
<label for="password">Password:</label><br/>
<input type="password" name="password" id="password" />
<input type="submit" name="swvar" value="Login"/>
<input type="submit" name="swvar" value="Forgot Password" />
</form>
It will not allow me to process what’s in the value field of the button like when I submit the form using “action” and “method” fields in the form tag.
I can get it to work by adding a hidden field with the necessary info, but that is only useful when there is only one button in the form. How can I modify this to use the button field values so I can put more than one button on the form?