After diving into learning ASP.NET MVC 4, I dabbled in some small projects...
On my index page, my goal is to fetch a JSON file containing data and showcase it on the main page.
In basic HTML and JavaScript, I utilize ajax for fetching or posting JSON data
<script>
$.ajax({
type : "GET",
dataType : "json",
url : "www.site.com",
success: function(data){
alert(data);
}
});
</script>
In my MVC 4 project, where should I execute the jQuery $.ajax command to retrieve and display data?
Should I call it in the View using jQuery syntax?
I would appreciate seeing an example.