I have an aspx page and a asp textbox control which has ajax autoCompleteExtender. I want the page to be redirected to another page according to the selected element from the autocomplete list. But when I use
window.location()
nothing is happening, just the same page is refreshed. Here is my javascript;
<script type="text/javascript">
function selectCity() {
var str = document.getElementById('<%= txtSearchForDestination.ClientID %>').value;
var array = str.split(",");
var city = array[0].replace(/^\s\s*/, '').replace(/\s\s*$/, '');
city = city.replace(/ /g, "+")
var country = array[1].replace(/^\s\s*/, '').replace(/\s\s*$/, '');
country = country.replace(/ /g, "+")
window.location.href("City.aspx?city=" + city + "-" + country);
}
</script>
The script is working, I tried it with like
alert(“City.aspx?city=” + city + “-” + country)
there is no problem. But when I want to redirect to that page it is not working. I also tried
window.location(“http://www.google.com”)
it’s not working as well.
What can be the problem ?
Have you tried:
?