Since you're requesting some data and in response you get some data from data base, you can use Ajax post or getJson. I feel its good to use getJson in which you will serialize the data and send it back to view or you simple use JsonResult that's provided in MVC itself.
The difference between Http Get and Http Post are always confusing to many developers. Get method requests data from a specified resource and post method submits data to be processed to a speicified resource. Where parameters passed via get methods are attached in url and post method parameters wont.
<script type="text/javascript">
$(document).ready(function () {
$('#btnGetValue').click(function () {
//Requesting controller action from getJson
$.getJSON("/Home/GetJsonData", null, function (data) {
var div = $('#ajaxDiv');
div.html("<br/> " + "Persons received from server: " + "<br/>");
$.each(data, function (i, item) {
//This is where you'll get all the items returned from the controller.
printPerson(div, item);
});
});
});
});
</script>
and in controller,
public JsonResult GetJsonData()
{
var persons = new List<Person>
{
new Person{Id = 1, FirstName = "F1",
LastName = "L1",
Addresses = new List<Address>
{
new Address{Line1 = "LaneA"},
new Address{Line1 = "LaneB"}
}},
new Person{Id = 2, FirstName = "F2",
LastName = "L2",
Addresses = new List<Address>
{
new Address{Line1 = "LaneC"},
new Address{Line1 = "LaneD"}
}}};
return Json(persons, JsonRequestBehavior.AllowGet);
}
you can use getJson for loading dropdownlist, populating other controls, list or whatever.
further reading on getJson and Json result are JSON with MVC 4 JsonResult