方法没有在ajax调用的控制器中调用

时间:2016-12-23 08:22:23

标签: jquery ajax model-view-controller

我的get ajax请求未从一个帖子请求的响应中调用。以下是代码

$("#buttonclick").on("click", function () {
    var projectCollection = "DefaultCollection";
    var project = $("#Configuration_iCodeProjectID").val();
    var definitionId = $("#buildDefinition").val();
    //if (validateTriggerNewBuild) {
    $.ajax({
        type: "POST",
        url: "/Operations/TriggerBuild",
        data: { "projectCollection": projectCollection, "project": project, "definitionId": definitionId },
        datatype: "application/json",
        success: function (data) {
            var buildId = $("#hdnBuildDefinitionId");
            buildId.text(data);
            startGetProgress();
        }
    })
    //}
});
function startGetProgress() {
    window.progressID = setInterval(getProgress(), 10000); // update progress every 10 seconds
}

function getProgress() {
    var buildId = $("#hdnBuildDefinitionId").text();

    $.getJSON('GetBuildLogs', function (data) {

    });
    private JsonResult GetBuildLogs() {
        //get the id for the currently running build

        //connect to the tfs service to get the logs

        //populate the textbox with the logs

        return Json(string.Empty, JsonRequestBehavior.AllowGet);
    }
}

根据按钮单击我试图在textarea中加载值,但我的方法没有被调用。我不确定这是否可行,或者我有更有效的方法。请提供宝贵的建议。

1 个答案:

答案 0 :(得分:1)

Action方法access modifier更改为公开