Reputation: 683
I have a function that puts my URL together. It looks like this:
$url = "/BT_Mathys_LNr_export_0.1/services/BT_Mathys_LNr_export?method=runJob";
$i = 1
$('#myForm :input').each(function() {
$inputName = $(this).attr('name');
if ($inputName != 'submit') {
$url = $url + "&arg"+$i+"=--context_param%20"+$inputName+"="+$(this).val();
$i++
};
});
The function adds my values from the input fields together in my URL and it worked perfectly until now. Now I have to add a <select>
in my form and have to pass that value also, exactly like I do with the values from the input fields.
How can I add in the code that my value from the <select>
will also be included as a parameter in the URL exactly like the input fields?
Upvotes: 0
Views: 154
Reputation: 1078
In case you want to add a <select>
control, serialize might not work, to workaround I think you should add a hidden field to store the selected option of select, and serialize()
will do the rest for you.
Upvotes: 0
Reputation: 1078
Why don't you use jQuery to do that: $("#your_form").serialize();
Upvotes: 1