jQuery AJAX submit form

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

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?


Text Copied From stackoverflow.com
on : Fri, Dec 25, 2009 Views : 1403803

Accepted Answer

You can use the ajaxForm/ajaxSubmit functions from Ajax Form Plugin or the jQuery serialize function.


url: 'server.php', type: 'post'


url: 'server.php', type: 'post'

ajaxForm will send when the submit button is pressed. ajaxSubmit sends immediately.


$.get('server.php?' + $('#theForm').serialize())  $.post('server.php', $('#theForm').serialize()) 

AJAX serialization documentation is here.

Text Copied From stackoverflow.com
on : Fri, Dec 25, 2009

Ask Question

If you want to ask question you must LogIn or SignUp
Login SignUp

Quick Links



Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..


Login to Open ESchool OR Create your account    Login   SignUp