Hi all i cant able to load the table values in ajax success function. I tried to load the values of the table in ajax success function.But it not loading the values properly
My Controller
public JsonResult GetData(int ID=3, int PID=1001)
{
try
{
List
grplist= new List
();
var Par = new Parameters();
par.Add("ID",ID);
par.Add("PID",PID);
var grptable = StroredProc..GetDataTable(spGetDetails",par);
for(int i=0;i
{
DetailModel grp= new DetailModel();
grp.name = grptable.Rows[i]["name"];
grp.Relation= grptable.Rows[i]["Relation"];
grplist.Add(grp);
}
return Json( grplist, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
Common.AddModel_Log4Net();
throw new Exception(ex.ToString());
}
}
My View
| Name | Relation |
|---|---|
@item.name | @item.Relation |
My Script
$('#OperationddlYear10').on('change', function () {
$.ajax({
type: "GET",
url: '@Url.Action("GetData", "Home")',
datatype: "Json",
data: { ID: 3, PID: 1001 },
success: function (data) {
for(i=0;i
{
$('prebody').html( $('prebody').html() + ''+data[i].name+' ' +
''+data[i].Relation+' ');
}
}
});
});
Above is my code.Now i want to load the table values in ajax success function on year change event but it is not working any one check and help me to resolve this issue .Thanks.

Sachin SinghRank #66 · 26.2K reputationPosted May 13, 2021, 3:30 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted May 13, 2021, 4:01 AM EDT
Sneha KRank #2,496 · 563 reputationPosted May 13, 2021, 3:33 AM EDT
Sneha KRank #2,496 · 563 reputationPosted May 13, 2021, 3:39 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted May 13, 2021, 3:46 AM EDT
Sneha KRank #2,496 · 563 reputationPosted May 13, 2021, 3:48 AM EDT
Ruchi SharavatRank #1,714 · 885 reputationPosted May 13, 2021, 12:29 PM EDT
Anish AnsariRank #293 · 8.6K reputationPosted May 15, 2021, 10:44 PM EDT