Although there is no error in the code, I am facing an issue where, after selecting an option from the brands dropdown, when I type in the product field, it passes "%" instead of the brand id (1, 2, or 3). Is there a way to modify the code so that it passes the selected brand id value to the PHP file?
Here is the code snippet:
$().ready(function(){
$("#product").autocomplete("ajax/php/product_search.php?brands=" + $('#brands').val() +"&",
{
width: 260,
matchContains: true,
selectFirst: false,
formatItem: function(data, i, n, value) {
return value.split("|")[0];
}
}
);
});
This is the HTML select list for brands:
<select id="brands" name="brands">
<option value="%">-- Select --</option>
<option value="1"> JVC - PLAYER SET </option>
<option value="2"> CLARION - PLAYER SET </option>
<option value="3"> DLS </option>
</select>