2

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 5

5

using serialize() method of your jquery form wrapper object !

see : http://api.jquery.com/serialize/

Sign up to request clarification or add additional context in comments.

Comments

2

http://api.jquery.com/serialize/

http://api.jquery.com/serializearray/

Comments

1

Try jQuery serialize.
Example from jQuery site

$('form').submit(function() {
  alert($(this).serialize());
  return false;
});

Comments

0

You can use jQuery .serialize to serialize all input fields in the form. Try below script and alert the value,

   var formValues =  $('form').serialize();
   alert(formValues);

Comments

0

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

What from the javascript, jquery, ajax, forms and post tags gave you the impression he's using ASP.NET?
sorry that was my bad, I must have conflicted it with something else

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.