[eluser]Mitja B.[/eluser]
i make this JS function
Code:
function spremeniVrednost()
{
izb = $("#select1").val();
$.post("http://localhost/btraker/admin/fetchjson/"+izb, { func: "getNameAndTime" },
function(data){
//alert(data.gdfgf); // John
//console.log(data.gdfgf); // 2pm
$("#select2").removeOption(/./);
$("#select2").addOption(data);
}, "json");
}
and
Code:
$drzava = '<select name="select1" id="select1">';
$drzava .= '<option value="">izberi</option>';
foreach($submenu->result() as $cat):
$id = $cat->Id;
$ime = $cat->title;
$drzava .= "<option value=$id>$ime</option>";
endforeach;
$drzava .= '</select>';
$mesto = '<select name="select2" id="select2">';
$mesto .= '<option value="">izberi</option>';
$mesto .= "</select>";
but select2 are not filled and is still empty.
what i am doing still worng?