i have a select element with multiple selection, like this:
<select multiple>
<option value="en">English</option>
<option value="de">German</option>
</select>
And i have a javascript, which should use selected values, looking like:
$.ajax({
url: window.location.protocol + "//example.com/search",
jsonp: "jsonp",
dataType: "jsonp",
data: {
q: querykeyword,
client: "chrome",
hl: "HERE SHOULD APPEAR ONE OR TWO SELECTED VALUES"
}
So the last code line should look like hl: "en" or, hl: "de", or hl: ["en","de"].
How can i transfer values from select element into javascript?
document.querySelector("select").valuehl: ["en"]and consistently sent an array