this is the javascript function that I have
function GetUserAddress() {
var address = '<%= Session["addressmap"].ToString() %>';
return address;
}
I want to set the value for this dropdown list below to whatever address this function returns
<select id="end">
<option value="" >Select Value</option>
<option value="GetUserAddress()" ></option>
</select>
Considering your address variable returns an Array, you can do something like this in plain JS to create custom options.
jsfiddle DEMO : jsfiddle
<select id="end">
<option value="" >Select Value</option>
</select>
<script>
(function() {
var address = ['USA','Australia'];
var select = document.getElementById("end");
for (var i = 0; i < address.length; i++) {
var option = document.createElement("option");
option.setAttribute("value", address[i]);
option.text = address[i];
select.appendChild(option);
}
})();
</script>
This is just to give you an idea of how you can achieve dynamic operations.