There is no error in the code but the problem is when I type in product text filed after I select a option from brands it should pass the brand id but instead of that it pass “%” this but I want to pass 1,2 or 3 no matter which brand I selected it pass “%” this to the php file. I want know is there a way to pass changed brand id value to the php file
This is my code
$().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 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>
You’re constructing the URL when the page loads. If you want the URL to be dynamic, you have to provide a function that performs the AJAX call when the completion is requested.