Im using the folowing to search a database :
<script type="text/javascript">
$(function() {
$("#lets_search").bind('submit',function() {
var cat1 = $('#cat1').val();
$.post('db.php',{cat1:cat1}, function(data){
$("#search_results").html(data);
});
return false;
});
});
</script>
cat1 is the id of a drop down box. I want to add another drop down box so that the query would be :
SELECT *
FROM business
WHERE category='".$_POST['cat1']."' and subcategory='".$_POST['cat2']."'
I cant seem to get the javascript to work with more than one drop down. I have tried this , but it didnt work.
<script type="text/javascript">
$(function() {
$("#lets_search").bind('submit',function() {
var cat1 = $('#cat1').val();
var cat2 = $('#cat2').val();
$.post('db.php',{cat1:cat1},{cat2:cat2}, function(data){
$("#search_results").html(data);
});
return false;
});
});
</script>