I'm trying to return the dataset value in the ajax method response. But I couldn't
I just returned as dataset but I'm unable to do it
Controller Code
public DataSet getDetailsBasedonSessionid(int sesson_id)
{
using (SqlConnection conn = new SqlConnection(connstring))
{
DataSet ds = new DataSet();
using (SqlCommand cmd = new SqlCommand("[dbo].[sGetUser]", conn))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@sesson_id", sesson_id);
try
{
conn.Open();
using (SqlDataAdapter adp = new SqlDataAdapter(cmd))
{
adp.SelectCommand = cmd;
adp.Fill(ds);
DataTable dt1 = ds.Tables[0]; enter code here
DataTable dt2 = ds.Tables[1];
}
return ds;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
return null;
}
View Code
function Score(){
debugger;
$.ajax({
url: '@Url.Content("myurl")',
type: 'GET',
data: { sesson_id: '@ViewBag.Statement' },
cache: false,
async: false,
success: function (result) {
result.append(k);
}
});
}
I expect the output as First data of first table. But it doesn't return anything but it's running