Here is my example:
var form= $(".anyclass form");
var sf = form.serialize();
$.post(form[0].action,
Let’s suppose that there is only one form in the page that fits the criteria.
Why I need to access the action property using [0]?
Why the .serialize() is done without [0]?
Sorry about this newbie question.
I think you want to do it like:
By the way: you are getting all forms within an element with the class .anyclass. This will return multiple forms (if present). Ýou’ll be better of if you gave the form some id and get it that way: $(‘#myForm’).