Is there an option getting the query (e.g. ?name=value&...) from a form? what I have done so far is iterating each element in the form and building the query string manually but is there an option avoiding that??
-
Some modern browsers let you simply submit the form with a "FormData" object that constructs that information for you, but I'm not sure it's in enough browsers to use yet.Katana314– Katana3142014-12-23 16:28:25 +00:00Commented Dec 23, 2014 at 16:28
-
Mike's answer is correct. If you want the value of an individual element, you can either give the input and "id" and then use the "id" selector, or you can do something like this. $("input[name='input_name_here']").val();9997– 99972014-12-23 16:45:25 +00:00Commented Dec 23, 2014 at 16:45
Add a comment
|
1 Answer
You can use jQuery and call .serialize() on the form element selector.
If you have a form:
<form id="some-form">...</form>
Then you can serialize it with this:
$('#some-form').serialize();
More information: http://api.jquery.com/serialize/