I have a form with name orderproductForm and an undefined number of inputs.
I want to do some kind of jQuery.get or ajax or anything like that that would call a page through Ajax, and send along all the inputs of the form orderproductForm.
I suppose one way would be to do something like
jQuery.get("myurl",
{action : document.orderproductForm.action.value,
cartproductid : document.orderproductForm.cartproductid.value,
productid : document.orderproductForm.productid.value,
...However I do not know exactly all the form inputs. Is there a feature, function or something that would just send ALL the form inputs?
$("#idForm").submit(...)rather than$("#submitButtonId").click(...)– Renato Feb 12 '13 at 12:54return falseyou should be usinge.preventDefault()to allow further event propagation after your click handler is complete. Usinge.preventDefault()will only stop the default action of the Submit button (e.g. to submit the form) but will allow any other events bound to that form to execute. See: fuelyourcoding.com/jquery-events-stop-misusing-return-false – John Kary Jun 3 '13 at 8:06data: $(this).serialize(),instead ofdata: $("#idForm").serialize(),which enables us to specify which form in just one location. – beingalex Jul 2 '14 at 14:15