Sagar

Sagar

  • NA
  • 95
  • 24.8k

dropdown bind from ajax call

Jan 21 2015 5:16 AM
hello plz help me ,
 
actually m binding a dropdown list using this code
 
<script type="text/javascript">
$(document).ready(function () {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "AddBooks.aspx/BindddlCategory",
data: "{}",
dataType: "json",
success: function (data) {
$.each(data.d, function (key, value) {
$("#ddlCategory").append($("<option></option>").val(value.CategoryId).html(value.Category));
});
},
error: function (result) {
alert("Error");
}
});
});



</script>
also [webmethod] invoking fine but the problem is this dropdown gets populated if my page contains <form runat= "server"> tag
 
 
& if m using masterpage & in its content page the dropdown is not populating...
 
 
can u tell me y???
 
 
 
 
 
 
 

Answers (1)