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.
8 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Anish AnsariPosted May 16, 2021, 2:44 AM
Ruchi SharavatPosted May 13, 2021, 4:29 PM
Sachin SinghPosted May 13, 2021, 8:01 AM
Sneha KPosted May 13, 2021, 7:48 AM
Sachin SinghPosted May 13, 2021, 7:46 AM
Sneha KPosted May 13, 2021, 7:39 AM
Sneha KPosted May 13, 2021, 7:33 AM
Sachin SinghPosted May 13, 2021, 7:30 AM