Jquery .Ajax error when trying to POST data in ASP.NET MVC
- by GB
I am unable to access an action in my controller using .ajax.  The code works on my development machine but as soon as I place it on the server it gives the error 401 Unauthorized.  Here is a snippet of the code in the .aspx file...
var encoded = $.toJSON(courseItem);
    $.ajax({
        url: '<%= Url.Action("ViewCourseByID", "Home") %>/',
        type: "POST",                        
        dataType: 'json',
        data: encoded,
        //contentType: "application/json; charset=utf-8",
        success: function(result) {
Update: The only time this doesn't work is when I pass json data to the Ajax call, it works fine with HTML data.