Jquery .Ajax error when trying to POST data in MVC C#

Posted by GB on Stack Overflow See other posts from Stack Overflow or by GB
Published on 2010-04-09T20:32:10Z Indexed on 2010/04/09 20:43 UTC
Read the original article Hit count: 354

Filed under:
|
|
|

Hello, 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) {

Thank you for the help.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about asp.net-mvc