I am currently using ajax and jquery to update search results using a form that has different categories for filtering.
My problem is that I want to be able to pass different variables to the url that I use for my ajax from checkboxes and other form elements from the current page.
I have the url " http://example.com/search/results/?cat=tech&min=5&max=30 " in my ajax call below and I need this url to upgrade to " http://example.com / search / results /? cat = service & min = 10 & max = 30 "or even remove the parameter if it is not even selected as" http://example.com/search/results/?min=5 "
<form>
<input type="radio" name="cat" value="" /> None<br />
<input type="radio" name="cat" value="service" /> Service<br />
<input type="radio" name="cat" value="tech" /> Tech<br />
<input type="radio" name="cat" value="other" /> Other<br />
<input type="radio" name="min" value="5" /> 5<br />
<input type="radio" name="min" value="10" /> 10<br />
<input type="radio" name="min" value="15" /> 15<br />
<input type="radio" name="max" value="5" /> 5<br />
<input type="radio" name="max" value="10" /> 10<br />
<input type="radio" name="max" value="15" /> 15<br />
</form>
<div class="result"></div>
<script type="text/javascript">
$(document).ready(function(){
$('.filter').live('click focus', function(){
$.ajax({
url: http:
context: document.body,
success: function(data) {
$('.result').html(data);
}
});
});
});
</script>
, URL- ajax URL-. , .
, - PHP http_build_query, , - , , . , concatantate
- http://example.com/search/results/cat/tech/min/5/30 ", .