I know there are 1 million and 1 questions on this, but I cannot seem to find an answer.
I am receiving data via PHP as such
echo json_encode($result); 
From a typical MYSQL query.
I get the result back like this in the console.
[{"id" : "1", "name" : "bob"}] 
I am trying to use $.each to iterate through this so I can process my results but I only get errors, undefineds or 0[object Object].. things like that.
My goal is to append each value to a input box (retrieving data from a table to put into an edit box).
$.post('getstuff.php', { id : id } function(data){
  $.each(data), function(k,v){
    $('input[name= k ]').val(v);
  });
});
As you can see i was hoping it was as simple as a key=>value pair but apparantly not. I have tried parsing, stringifiying.. really I am lost at this point. I also cannot tell $.post that I am using JSON because I am using a more arbitrary function, but am just posting that as my example.
Edit
            var retrievedData = JSON.parse(data);
        $.each(retrievedData, function(k,v){
            for (var property in retrievedData) {
                if (retrievedData.hasOwnProperty(property)) {
                    console.log(k);
                    console.log(v);
                    console.log(property);
                    //$('input[name= k ]').val(v);
                }
            }
        });
 
     
     
     
     
     
    