If it is the first time site is loading, then when user selects the location dropdown for hospital, it should pass the hos=somelocation as querystring to the URL. http://mysite/events/Pages/default.aspx?hos=Munster
If the URL already has one along with other querystring like http://mysite/events/Pages/default.aspx?kwd=cancer&hos=Munster
then I need to check for if &hos already is in the window.location.search..and if there is one already, then replace whatever value it has with the one recently selected without appending to it like this: http://mysite/events/Pages/default.aspx?kwd=cancer&hos=Munster&hos=Carmel -> which is not what I want. I want this to be http://mysite/events/Pages/default.aspx?kwd=cancer&hos=Carmel once user selects Carmel from the location Dropdown. Someone Please Help!!
$(".LocationDropDown").change(function(e){
var querystring=window.location.search;
var currentURL=$(location).attr('href');
if(querystring=='') {
window.location.href= ( $(this).val() == "All Hospitals" ) ? 'http://mysitee/events/Pages/default.aspx':'http://mysite/events/Pages/default.aspx?hos='+$(this).val();
}
else
{
window.location.href = ( $(this).val() == "All Hospitals" ) ? 'http://mysitee/events/Pages/default.aspx':currentURL+'&hos'+$(this).val();
}
});