I need to do the following using a combobox.
Select box
has a default list of cities which the user can search from.
Why don't you duplicate the plugins and two combo boxes.
Then:
$( "#combobox1" ).combobox1({
select: function (event, ui) {
var value = ui.item.value;/*Whatever you have chosen of this combo box*/
$.ajax({
type: "POST",
dataType: 'json',
url: "script.php",
data: {
'anything':value
},
success: function(res)
{
/*replace your next combo with new one*/
$("select#combobox2").html(res);
}
});
}
});
$( "#toggle" ).click(function() {
$( "#combobox1" ).toggle();
});
$( "#combobox2" ).combobox2();
$( "#toggle" ).click(function() {
$( "#combobox2" ).toggle();
});
PHP file (This is based on Codeigniter):
db->query("SELECT * FROM table WHERE field='".$keyword."'");
$data.= "";
if($query4->num_rows() > 0)
{
foreach($query5->result_array() as $row)
{
$data.= "";
}
}
echo json_encode($data);
}
?>
Hope this helps.