Nicholas Wallen12,278 Points
Does serialize automatically look for form data?
He explicitly pointed to the action part in regards to where the URL goes to, but the part that is actually supposed to point to the form itself....where is that?
Cody Fisher8,795 Points
The form is selected using jQuery like so:
Then, an event handler is added to the form for the submit event:
Finally, the submit function receives a callback function that does the processing when the submit event occurs. Therefore, all of the code taking place within the event listener's callback function can reference the form itself using the 'this' keyword.
So this line here:
var formData = $(this).serialize();
Calls the jQuery serialize function on the form itself.
If you are curious to know more about how serialize() is able to pull the data from the individual form elements, the jQuery link below has good documentation and a demo that can thoroughly explain its inner workings.