I’m trying to use the validate plugin but I guess it’s not setup correctly. This is my header:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>
<title>Registration Page 2</title>
<script type="text/javascript">
$(document).ready(function(e) {
$("#everything").submit( function() {
var data = $("#everything").serializeArray();
$("#everything").validate({
alert(data);
});
return true;
});
});
</script>
</head>
But it’s not recognizing the validate method so it is not using it. Should I use a different source? Can anyone see any problem?
P.S: Is there anyway to serialize all the data in a form into an array so I can reference it like
data["first_name"]
I tried the serializeArray and did:
alert(data["first_name"]);
But it said it was undefined. Anyone know how to do that? Thanks
Try this demo
You can use jquery .each function to iterate over arrays
.each