jquery binding a key value pair
<p>Hi I am using spring mvc in my application. The service returns a json response like,</p>

<pre><code>[
{
"Key1": "value1"
}
]
</code></pre>

<p>I need to bind only the value part from the response to a drop down list in a jquery dialog. i use an AJAX call to get the list of items and bind it. But it binds the whole row in the drop down list</p>

<p>The code I used for binding the response is</p>

<pre><code>   &lt;script type="text/javascript"&gt;
$(function() {
    $
            .ajax({
                type : "GET",
                url : "countries/getname",
                contentType : "application/json; charset=utf-8",
                dataType : "json",
                success : function(msg) {
                    alert("MSG:"+msg);//this gives {"Key1": "value1"}

                    $.each(msg,function(key, val) {
                        alert("KEY::"+key);//key is returned as 0
                        alert("VALUE::"+val);//value is returned as{"Key1": "value1"}

                                                $('&lt;option /&gt;', {value: key, text: val}).appendTo("#sampleResp");

                                    });
                },
                error : function() {
                    $("#sampleResp").get(0).options.length = 0;
                    $("#sampleResp").get(0).options[0] = new Option(
                            "None", "None");
                }
            });
});
&lt;/script&gt;
</code></pre>

<p>The value field is the item and it has { "Key1": "value1"}. SampleResp is the ID of the dropdownlist </p>

<p>the jsp code is</p>

<pre><code>&lt;div&gt;
    &lt;form:select path="sampleResp" cssClass="w200"&gt;                     
    &lt;/form:select&gt;
&lt;/div&gt;
</code></pre>

<p>How to extract only the value part from the response and bind it in drop down using ajax call in jquery? Please help.</p>
