cant get return value in nodejs?

i have following tutorial how to request value from node js and return back to user requested but not successful,,,

here my javascript code..

put('id','coment',function(data) { 
        var obja = JSON.parse(data);
        var items = Object.keys(obja);
        items.forEach(function(item) {  
            alert(obja[item].field1); //its no result value     
        });                         
})
function put(id, data, callback) { //call from here to nodejs
        $.ajax('http://localhost:8000/' + id + '/', {
            type: 'POST',
            data: JSON.stringify(data),
            dataType: 'json',
            success: function(data) { if ( callback ) callback(data); },
            error  : function() { if ( callback ) callback(false); }
        });
    }

and here my nodejs

connection.query("SELECT field1,field2,field3 from table", function(e, row) {
                    if(e)
                    {
                        console.log('An error occured: '+e)
                    }
                    else
                    {
                        try{                        
                            res.write(JSON.stringify(row));  //send value back to user requested
                            res.end();
                        }catch(ex){
                            console.log('errror' + ex) ;
                        }
                    }
}); 

in console,the query was load normally but when i try send back to user requested,its get no value.

my problem is,why i cant send back to user requested?

You shouldn't need var obja = JSON.parse(data); because it will already be parsed by jQuery due dataType: 'json' being set.

Also based on the code you've shown obja is an Array so instead of this:

var items = Object.keys(obja);
items.forEach(function(item) {  
    alert(obja[item].field1);
});

Just do this:

obja.forEach(function(row){  
    alert(row.field1);
});