• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
getJSON in CI problem

#11
[eluser]Mitja B.[/eluser]
anyone please?

#12
[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?

#13
[eluser]Mitja B.[/eluser]
SOLVE

If anyone has similar problem. you need jquerySelect.js and jquery.js library. jquery.js is not enough, you stil need jqueryselect.js


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.