title: MVC4 razor fill dropdownlist with data from json
body: <p>I have two dropdownlists for  Languages and Countries</p>
  
  <p>On selecting a language in the dropdownlist, should fill corresponding countries in the country dropdownlist</p>
  
  <pre><code> @Html.DropDownList("LanguageSelectList", null, null, new { @class = "hyper-select fixedwidth300"})
  @Html.DropDownList("CountrySelectList", null, null, new { @class = "hyper-select fixedwidth300" })
  </code></pre>
  
  <p>Here is my jquery script</p>
  
  <pre><code> $("#LanguageSelectList").change(function (event) {
              $("#languageValidator").hide();
              var selectedLanguage = $("#LanguageSelectList").val();
              debugger;
              //--------
              if (selectedLanguage!='') {
                  var url = '@Url.Action("GetCountryListByLanguage", "Options")';
                  $.ajax({
                      type: "POST",
                      url: url,
                      data: { selectedLanguage: selectedLanguage },
                      dataType: "json",
                      contentType: "application/json; charset=utf-8",
                      global: false,
                      async: false,
                      success: function (data) {
  
                          var ddlCountrylist = $("#CountrySelectList");
                          debugger;
                          var jsonString =JSON.stringify(data);  
                          //here how to take data from jsonstring to countries dropdownlist
  
  
                      }
  
                  });
  
              } else {  
                  alert('no country returnned');
  
  
              }
  
              //--------------
  
          });
  </code></pre>
  
  <p>I am able to retrieve the <strong>expected list of countries in the json data as given below</strong> .Now how do I fill my country dropdownlist. </p>
  
  <pre><code>jsonString="[{\"Selected\":false,\"Text\":\"n/a\",\"Value\":\"\"},{\"Selected\":false,\"Text\":\"China\",\"Value\":\"CN\"},{\"Selected\":false,\"Text\":\"Hong Kong\",\"Value\":\"HK\"},{\"Selected\":false,\"Text\":\"Singapore\",\"Value\":\"SG\"},{\"Selected\":false,\"Text\":\"Taiwan\",\"Value\":\"TW\"}]"
  </code></pre>