I need to send a complete form via ajax to prevent the refresh of the complete page. Since the form has a huge number of inputfields, i dont want to build the querystring manually. I found some scripts collecting all elements in the form and building the querystring automatically. But is there any easier way to build the query string automatically?
5 Answers
using serialize() method of your jquery form wrapper object !
Comments
Try jQuery serialize.
Example from jQuery site
$('form').submit(function() {
alert($(this).serialize());
return false;
});
Comments
you need to have the info in your page and send it in a query string to another page right??
you could simply add the Previous page Type directive in the page you're redirecting to, and add properties in your first page to return the values in the controls and call it using previous page property refer to this article
2 Comments
Anthony Grist
What from the javascript, jquery, ajax, forms and post tags gave you the impression he's using ASP.NET?
Maha Khairy
sorry that was my bad, I must have conflicted it with something else