Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi ,

I have an class ,
Class students { public int id;
Public string name;
List<marks> marks {get; set};

}

Class marks { string subject {get; set};
Int marks {get; set};
}

I want to get values from c# using jQuery Ajax and after doing few operations I need to c# action methods using ajax call guide me

What I have tried:

Public actionresult getmarks()
{


Return Json(students, jsonbehavior.allowget);
}

In js

I need to do Ajax call after words I need to send these objects to another controller
Posted
Updated 12-Dec-17 20:54pm
Comments
F-ES Sitecore 13-Dec-17 4:25am    
Google how to use jquery ajax with mvc, this is very well documented.

1 solution

function getmarks() {



       $.ajax({
           url: '/controlername/getmarks',
           type: "GET",
           datatype: "JSON",
           data: '',
           success: function (result) {
               alert(result);


           },
           error: function () { alert("Something went wrong..") },
       });
   }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900