i have a autocomplete text box
this is the controller
[HttpPost]
public ActionResult GetRecord(string prefix)
{
DataSet dst = new DataSet();
dst.Tables.Add(op.GetName(prefix));
List searchlist = new List();
foreach (DataRow dr in dst.Tables[0].Rows)
{
searchlist.Add(new DataSearch
{
label = dr["ARTICAL_NAME"].ToString(),
val = dr["ARTICL_ID"].ToString()
});
}
return Json(searchlist);
}
and this is the Ajax
i want resutl appaer as drop down list
$(document).ready(function () {
SearchText();
});
function SearchText() {
$("#MyId").autocomplete({
source: function (request, response) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: '/Home/GetRecord',
data: "{'prefix':'" + document.getElementById('MyId').value + "'}",
dataType: "json",
success: function (json) {
//alert( json[0].label);
response(json)
{
//alert( json[0].label);
$("#MyId").append($("").val(json[0].label).html(json[0].label)); }
},
error: function (result) {
alert("No Match");
}
});
}
});
}
any help ?

Navaneeth KrishnanRank #1,172 · 1.5K reputationPosted Aug 30, 2020, 3:33 AM EDT
Nisha RegilRank #1,956 · 748 reputationPosted Aug 30, 2020, 10:05 PM EDT
Mageshwaran RRank #411 · 6.1K reputationPosted Sep 2, 2020, 1:47 AM EDT
Laxmidhar SahooRank #383 · 6.6K reputationPosted Sep 2, 2020, 3:21 AM EDT