﻿<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
<script>
    var data = (function ($) { 
        var getData = (function() {
            $.ajax({
                method: "GET",
                url: "GetMammals",
                dataType: "json",
                success: function (response) {
                    print(response);
                },
                failure: function (response) {
                    alert(response.d);
                }
            });
        });

        function print(data) {
            document.write(
                data.Dog.Name + ": " + data.Dog.Type + " / " +
                data.Cat.Name + ": " + data.Cat.Type
                );
        }

        return {
            getData: getData
        }
    })(jQuery);
</script>

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
</head>
<body>
    <div>
        <script>
            data.getData();
        </script>
    </div>
</body>
</html>

﻿<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
<script>
    var data = (function ($) { 
        var getData = (function() {
            $.ajax({
                method: "GET",
                url: "@Url.Action("GetMammals", "Home")",
                dataType: "json",
                success: function (response) {
                    print(response);
                },
                failure: function (response) {
                    alert(response.d);
                }
            });
        });

        function print(data) {
            document.write(
                data.Dog.Name + ": " + data.Dog.Type + " / " +
                data.Cat.Name + ": " + data.Cat.Type
                );
        }

        return {
            getData: getData
        }
    })(jQuery);
</script>

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
</head>
<body>
    <div>
        <script>
            data.getData();
        </script>
    </div>
</body>
</html>

Fix 404 error when calling GetMammals, incorrect route
Fix 404 error when calling GetMammals, incorrect route
