I have a form
like below:
<form onsubmit="doSomething(this.form);">
<input type="text" name="groupName" />
<input type="text" name="groupColour" />
</form>
Now this doesn't have a submit button, I know. Instead, when the user hits the enter key I want it to trigger a function. In this example doSomething
.
Now in the function I will performing an AJAX request to insert a record to the database, however I'm not sure how to access the value that was entered in the text fields in my AJAX function doSomething
.
How do I pass to my function the values of the form when submitted?