Get value from Controller using jQuery Ajax in ASP.Net MVC

Last Reply 19 days ago By dharmendr

Posted 19 days ago

i have paramenters in my jquery function which has to get the value from controller but i am unable to get the value from controller by hitting the controller

how can i hit the controller and get that value from controller 

var searchCriteria = {};
searchCriteria.CareTeamId = $("#ddlCareTeam :selected").val();  
//fetching the first value at zero index instead i need to hit the controller and get that value 

 

 

Posted 19 days ago

Hi kavithav,

To fetch the value from Database you need make ajax call and pass the parameter to controller action method and inside the success function get the value.

Refer below article.

ASP.Net MVC: Call Controller Method from View using jQuery AJAX

If you don't want to make ajax call refer below article.

ASP.Net MVC: Call Controller Method from jQuery without AJAX