jQuery append()在ajax成功时不会更新容器

时间:2014-10-31 03:29:18

标签: javascript jquery ajax frontend

我有这个ajax电话:

 $.ajax({
            url: "AddStandardleistungenSelected",
            data: { services: services1 },
            dataType: "html",
            traditional: true,
            success: function (data) {
                $('#standartleistungen_list_selected').empty().append(data);
                $.ajax({
                    url: "GetStandardleistungenNotSelected",
                    data: { services: services1 },
                    dataType: "html",
                    traditional: true,
                    success: function (data2) {

                        $('#standartleistungen_list_NotSelected').empty().append(data2);
                    },
                    error: function (jqXHR, textStatus, errorThrown) {
                        alert("something went wrong");
                        console.log(textStatus, errorThrown);
                    }
                });

            },
            error: function (jqXHR, textStatus, errorThrown) {
                alert("something went wrong");
                console.log(textStatus, errorThrown);
            }
        });

应该在收到来自mvc控制器actionMethods的2个响应时更新2个容器,我收到响应,甚至成功更新反过来:

$.ajax({
        url: "AddStandardleistungenNotSelected",
        data: { services: services },
        dataType: "html",


   traditional: true,
    success: function (data) {
        $('#standartleistungen_list_NotSelected').empty().append(data);

        $.ajax({
            url: "GetStandardleistungenSelected",
            data: { services: services },
            dataType: "html",
            traditional: true,
            success: function (data2) {
                $('#standardleistungen_list_selected').empty().append(data2);
            },
            error: function (jqXHR, textStatus, errorThrown) {
                alert("something went wrong");
                console.log(textStatus, errorThrown);
            }
        });

    },
    error: function (jqXHR, textStatus, errorThrown) {
        alert("something went wrong");
        console.log(textStatus, errorThrown);
    }
});

我已经检查了我能想到的每一件可能的东西,这件事仍然不想更新!

请帮帮我!!! :(

0 个答案:

没有答案