为什么追加部分在ajax调用中不起作用

时间:2017-06-09 15:07:17

标签: javascript jquery asp.net-mvc

在我上传文档后的下面的代码中,我编写了一个循环,它应该将一些图像添加到一个名为Divnavigation的分区中,但这部分不起作用。

此外,当我取消注释时,即使我的documentViewer无法加载。我可以通过AJAX调用向我的部门添加一些内容吗?

function navigate(target) {
    $.ajax({
        url: '@Url.Action("Download", "Patient")',
        type: 'GET',
        async: true,
        dataType: 'json',
        cache: false,
        data: { 'filepath': target },
        success: function (results) {
            // documentViewer.loadDocument(results);               
            documentViewer.uploadDocumentFromUri(results[results.length -1]);
            documentViewer.addEventListener(gnostice.EventNames.afterDocumentLoad, function (eventArgs) {
                document.getElementById("TotalPage").textContent = documentViewer.viewerManager.pageCount;
                document.getElementById("pageNumber").value = documentViewer.viewerManager.currentPage;

                $("#Divnavigation").empty();
                //Get all images  with the help of model
                for (var i = 0; i < results.length; i++) {
                    $("#Divnavigation").append(" <ul> " +
                                     "<li>" +
                                     "<img src=" + results[i] + ">" + "</img>" +
                                     "<a href=" + @Url.Action("Download", "Patient") + ">" + "</a>" +
                                      "</li>"
                                + "</ul>");
                }
            });
            //showImages();
        },
        error: function () {
            alert('Error occured');
        }
    });
}

1 个答案:

答案 0 :(得分:-1)

您好首先回答您的问题:

我可以从.ajax电话中向我的部门添加一些内容吗?

您100%被允许通过.ajax调用向您的部门添加内容。毫无疑问。我亲自做了很多次

这次因为其他原因你没有得到。

现在我的建议是尝试使用$sudo find . -name "/Path/to/B*" -exec scp "{}" Me@137.92.4.152:/Path/to/ ';'

官方文件:https://api.jquery.com/html/

所以首先尝试通过放置像$("#Divnavigation").html().这样的简单html来查看是否获得输出。如果你得到改变,html字符串无论你想要什么,可以是硬编码字符串,甚至你可以从action方法中获取该字符串。

希望以上信息有用。请分享你的想法

由于