Ajax返回结果整数值为0

时间:2014-04-23 03:49:13

标签: jquery http-post

这里我正在调用我的控制器,并将一个对象类型作为参数传递。但是当我收到结果时,整数类型ID总是为0.但是从我的控制器返回正确的ID。

function saveLessonBasicDetails() 
{

 var basicViewModel = new Object();

    basicViewModel.ID = $("#lessonId").val();

    basicViewModel.Name = $("#Name").val();

    basicViewModel.Description = $("#Description").val();

    basicViewModel.Topic = $("#Topic").val();

    basicViewModel.KeyWords = $("#KeyWords").val();

    $.ajax({
        type: 'POST',
        url: "/CourseDesign/SaveLessonBasicInfo",
        dataType: 'json',
        data: '{"vm":' + JSON.stringify(basicViewModel) + '}',
        contentType: "application/json; charset=utf-8",
        success: SaveBasicInfoSuccess,
        error: SaveBasicInfoFailed
    });
}

function SaveBasicInfoSuccess(result) {

    alert(result.ID);

    $("#lessonId").val(lessonId);

    alert("Success");
}

function SaveBasicInfoFailed(result) {

    alert("Fail");

}

0 个答案:

没有答案