Hi I am unable to retrieve values from json object.The json data as coming like this when observe from firebug :

This is my ajax code:

        type: "POST",
        url: "getdata.php",
        dataType: "json",
        data: { 'dataString': projectid },
            for (var i = 0; i < data.length; i++)
                $("#projid").append("<option value=data[i].PROJECT_ID>data[i].PROJECT_ID</option>");              
getdata.php code :
$result = mysql_query("SELECT PROJECT_ID FROM projlist WHERE EMPID = 'emp1468'");
    $rowdata = array();
    $rows = array();
    while($r = mysql_fetch_assoc($result)) {
        $rows = $r;
    echo json_encode($rowdata);
    return $rowdata;

alert(data) is giving [object Object].
I tried like this data.PROJECT_ID, data[PROJECT_ID],data[i].PROJECT_ID but project id value is not displaying in select tag.
How can I retrieve from for loop?

I had find the syntax mistake.Now it is fixed like this

$("#projid").append('<option value='+data[i].PROJECT_ID+'>'+data[i].PROJECT_ID+'</option>');  


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.