Click here to Skip to main content
15,881,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hey all,

My design page code is

Java
$(document).ready(function () {
   $.ajax({
      type: "POST",
      contentType: "application/json; charset=utf-8",
      url: "ClientSales.aspx/BindDatatoDropdown",
      data: "{}",
      dataType: "json",
      success: function (data) {
         $.each(data.d, function (key, value) {
            $('#%=ddlCategory.ClientID%>').append($("<option><;/option>").val(value.cat_id).html(value.cat_name));
         });
      },
      error: function (data) {
      }
   });
});

This above function gets all the categories from database. I want to keep this function in different javascript file. I will be calling that function from all aspx pages. So, I don't know how to get data from jquery function and bind it in aspx dropdownlist
Posted
Updated 1-Sep-14 5:34am
v4

1 solution

your code is working in html control only
 
Share this answer
 
Comments
RAHUL(10217975) 1-Sep-14 9:07am    
I am able to bind the dropdownlist but the above function get exposed in page view source. I don't want that to be happen , I want to call that function from external javascript file

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900