$(document).ready(function () { debugger; $(".autosuggest").autocomplete({ source: function (request, response) { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "Saleorder.aspx/GetAutoCompleteData", data: "{'username':'" + document.getElementById('pagebody_txtSearch').value + "'}", dataType: "json", success: function (data) { debugger response(data.d); }, error: function (result) { alert("Error"); } }); }, select: function (event, ui) { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "Saleorder.aspx/GetSelectedValue", data: "{'username':'" + ui.item.value + "'}", dataType: "json", success: function (data) { debugger var obj = jQuery.parseJSON(data); alert(obj); // the alert (obj) is null value . How to bind the value to text box $("#<%=txtDeliveryDate.ClientID %>").val(data.d.ItemCode) }, error: function (result) { alert("Error"); } }); } }); });
eval
var jsonString = '{a: 1, b: 2}'; var jsonObject = eval('(' + jsonString + ')');
eval()
JSON.parse()
var object = JSON.parse('{"attr":"value"}');
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)