사이트가 처음으로로드되는 경우 사용자가 병원의 위치 드롭 다운을 선택하면 URL에 쿼리 문자열로 hos = somelocation을 전달해야합니다. http://mysite/events/Pages/default.aspx?hos=MunsterURL에 쿼리 문자열이 이미 있는지 jquery 확인
URL이 이미 나는 이미 존재하는 경우 & 호는 이미 window.location.search..and에 있는지를 확인하기 위해 필요 http://mysite/events/Pages/default.aspx?kwd=cancer&hos=Munster
같은 다른 쿼리 문자열과 함께 하나가있는 경우, 가지고있는 값을 다음과 같이 최근에 선택한 값으로 바꾸지 말고 바꾸십시오 : http://mysite/events/Pages/default.aspx?kwd=cancer&hos=Munster&hos=Carmel -> 이는 내가 원하는 것이 아닙니다. 나는 이것이 사용자가 Dropdown 위치에서 Carmel을 선택하면 http://mysite/events/Pages/default.aspx?kwd=cancer&hos=Carmel이되기를 원한다. 누군가 제발 도와주세요 !!
$(".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();
}
});
http://stackoverflow.com/questions/1090948/change-url-parameters-with-jquery – Anthony
는 자바 스크립트를 사용할 수는 [좋은 URI 객체 ] (http://stackoverflow.com/a/7853496/497418) ... – zzzzBov