title: How do I display values of an JSON object?
body: <p>Here is what I got so far. Please read the comment in the code. It contains my questions.  </p>
  
  <pre><code>var customer;   //global variable
  function getCustomerOption(ddId){
        $.getJSON("http://localhost:8080/WebApps/DDListJASON?dd="+ddId, function(opts) {
             $('&gt;option', dd).remove(); // Remove all the previous option of the drop down
             if(opts){  
                  customer = jQuery.parseJSON(opts); //Attempt to parse the JSON Object.
             }
        });
  }
  
  function getFacilityOption(){
        //How do I display the value of "customer" here. If I use alert(customer), I got null
  }
  </code></pre>
  
  <p>Here is what my json object should look like: <code>{"3":"Stanley Furniture","2":"Shaw","1":"First Quality"}</code>. What I ultimately want is that, if I pass in key <code>3</code>, I want to get <code>Stanley Furniture</code> back, and if I pass in <code>Stanley Furniture</code>, I got a <code>3</code> back. Since <code>3</code> is the customerId and <code>Stanley Furniture</code> is  customerName in my database. </p>