title: How to fill a DropDown using Jquery Ajax Call?
body: <p>I have a WebMethod which gets data that I want to fill DropDown with in a DataSet. 
  Currently I am filling the dropdown using a hardcoded object. But I want to replace this hard coded object with data returned by webmethod. </p>
  
  <pre><code> [System.Web.Services.WebMethod]
           public static string GetDropDownDataWM(string name)
           {
               //return "Hello " + name + Environment.NewLine + "The Current Time is: "
               //    + DateTime.Now.ToString();
  
               var msg = "arbaaz";
  
               string[] name1 = new string[1];
               string[] Value = new string[1];
               name1[0] = "@Empcode";
               Value[0] = HttpContext.Current.Session["LoginUser"].ToString().Trim();
               DataSet ds = new DataSet();
               dboperation dbo = new dboperation();
               ds = dbo.executeProcedure("GetDropDownsForVendor", name1, Value, 1);
  
               return ds.GetXml(); 
  
           }
  </code></pre>
  
  <p><strong>CLIENT SIDE(UPDATE 1):</strong> </p>
  
  <pre><code>  &lt;script type = "text/javascript"&gt;
      function GetDropDownData() {
          var myDropDownList = $('.myDropDownLisTId');
  
          $.ajax({
              type: "POST",
              url: "test.aspx/GetDropDownDataWM",
              data: '{name: "abc" }',
              contentType: "application/json; charset=utf-8",
              dataType: "json",
              success: function (data) {
                  $.each(jQuery.parseJSON(data.d), function () {
                      myDropDownList.append($("&lt;option&gt;&lt;/option&gt;").val(this['FieldDescription']).html(this['FieldCode']));
                  });
              },
              failure: function (response) {
                  alert(response.d);
              }
          });
      }
      function OnSuccess(response) {
          console.log(response.d);
          alert(response.d);
      }
  &lt;/script&gt;
  </code></pre>