MVCHaack Ajax Demo

Click on the button to make a call to ComicsDemoController's List method and populate an unordered list with the comics returned by that method.


comicsdemo.html
<script src="../../Scripts/jquery-1.6.2.js" type="text/javascript"></script>
<script src="/json/comicsdemo?json"></script>
<script src="/Scripts/comicsdemo.js"></script>

<ul id="comics"></ul>

<button id="loadButton">Load Comics</button>
comicsdemo.js
$(function() {
    $('#loadButton').click(
        function() {
            $mvc.ComicsDemo.List().success(function(data) {
                $.each(data, function() {
                    $('#comics').append('<li>' + this.Title + '</li>');
                });
            });    
        }
    );
});