Calling to JSON file in ASP.NET MVC 4

Viewed 25358

I started to learn ASP.NET MVC 4, did some small stuff...

In my index page I want to get JSON file with some data and display it on the main page.

In simple HTML,JavaScript I using ajax to GET/POST JSON data

<script>
$.ajax({
     type : "GET",
     dataType : "json",
     url : "www.site.com",
     success: function(data){
           alert(data);
     }
});
</script>

I created MVC 4 project, where should I call the jQuery $.ajax command to get data and display it ?

Do I have to call it in the View? and with the jQuery syntax?

I'll be happy to see any example

4 Answers
Related