title: populate dropdownlist on button click using jquery
body: <p>In my application ,I have a dropdownlist which is to be populated on button click.I tried some code which is working fine on document.ready but its not working on button click..</p>
  
  <pre><code>  $(document).ready(function () {
          $("#&lt;%=btn.ClientID %&gt;").bind('click',function () {
              //
              $.ajax({
                  type: "POST",
                  contentType: "application/json; charset=utf-8",
                  url: "gridpaging.aspx/binddropdown",
                  data: "{}",
                  dataType: "json",
                  success: function (data) {
                      $.each(data.d, function (key, value) {
                          $("#ddl").append($("&lt;option&gt; &lt;/option&gt;").val(value.UserId).html(value.UserName));
                      });
                      //
  
                  },
                  error: function (result) {
  
                      alert("Error occured");
                  }
              });
          });
      });
  </code></pre>
  
  <p>Please let me know where i went wrong..Thanks in advance..</p>