Can I bind asp.net dropdownlist using javascript/jquery? -
can bind asp.net dropdownlist using javascript/jquery? data jquery ajax web method want avoid postback @ point. still want postback , save data using server side code (i.e. still able dropdownlist1.selecteditem.text
) after binding using clientscripts.
is possible , can explain me how can done?
thanks,
use json ajax
syntax:
$.ajax({ datatype: "json", url: url, data: data, success: success });
see simple example json:
<script type="text/javascript"> $(document).ready(function () { var msgbox = $("#status"); $("#button1").click(function () { $.ajax({ type: "post", //page name (in method should called) , method name url: "beginjson.aspx/checkdatetime", // if want pass parameter or data server side function can try line // data: "{}", //else if don't want pass value server side function leave data blank line below data: "{'args':'somnath'}", contenttype: "application/json; charset=utf-8", datatype: "json", success: function (msg) { //got response server , render client msgbox.html(msg.d); } }); }); });