Question

I have an aspx page with a drop down list. When a selction is made, I need to pass the selected value to a javascript function in a different page. This second page is displaying a map using javascript:

<script>
    var map;
    var ServiceName = "http://some_url//this_is_dynamic_part/MapServer
    ....
</script>

so, from page1.aspx, I need to open this page in a new window and pass a parameter (i.e. drop down's selected value) to replace "this_is_dynamic_part" of variable ServiceName.

Was it helpful?

Solution

I would use a query parameter here. In the selection handler, when building the URL that you will pass to window.open(), append ?key=value, where value is the value you want to pass and key is some parameter name (anything you like).

Then your second page can refer to the value of the page parameters in location.search.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top