The page loads with the URL as http://mysite.aspx/result.aspx?k=("Hospital"). Now after the page load, if someone selects Offices checkbox, it should append the value of that Checkbox 'Office' to the URL as http://mysite.aspx/result.aspx?k=("Hospital" OR "Office")
How do I do this in jquery?
<div class="LocationSearchBox">
<input name="KeywordBox" class="BasicSearchInputBox" type="text" value="Type a Keyword.."/>
<div class="searchBtnHolder"><a class="searchButton" href="#" type="submit"><span>Search</span></a></div>
</div>
<br/><br/>
<div class="MyOptions">
Hospitals<input name="LocType" type="checkbox" value="Hospital"/>  
Offices<input name="LocType" type="checkbox" value="Office"/>  
Emergency Centers<input name="LocType" type="checkbox" value="Emergency"/> 
Out-Patient Centers<input name="LocType" type="checkbox" value="Out-Patient"/> 
Facilities<input name="LocType" type="checkbox" value="Facility"/>
</div>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
var url = 'http://mysite.com/results.aspx?k=("Hospital");
$(".LocationSearchBox a.searchButton").click(function(){
var chkboxVal = $("input[name='LocType']:checked").val();
var keywords = encodeURIComponent($(".BasicSearchInputBox").val());
url =url+"?kwd="+keywords+"&type="+chkboxVal;
window.location.href=url;
});
}):
});
Your code should have been something like this ...