javascript - 我可以同时在Jquery 中使用Append 和Load 功能吗?

标签 javascript jquery ajax

$(".eventName").click(
        function () {
            var eventId = $(this).attr('id');
            var role    = $(this).attr('dir');
            var todo = 'viewDetails';
            $("#details").load("plugins/company_calendar/calendar.php?eventId="+ eventId +"&todo="+ todo +"&role="+ role );
            $(this).find('.eventDetails').css("left", $(this).position().left + 20);
            $(this).find('.eventDetails').css("top", $(this).position().top + $(this).height());
            $(".eventDetails").fadeIn(10);
        }
    );

是否可以在详细信息中附加我加载的数据?

最佳答案

抱歉加载只是用结果替换了元素的内容。

你应该这样做

$.get("plugins/company_calendar/calendar.php?eventId="+ eventId +"&todo="+ todo +"&role="+role, function(response) {
    $("#details").append(response);
});

关于javascript - 我可以同时在Jquery 中使用Append 和Load 功能吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9800935/

相关文章:

javascript - 未能 "dynamically"导入 date-fns/locale 库 - TypeScript 给出尝试导入错误

javascript - AngularJS 奇怪的行为,NG-INCLUDE 导致整个页面重新加载

php - 无法在表中显示数据

javascript - 带有 jquery mobile 的微调器

javascript - 拒绝从 '*' 执行脚本,因为它的 MIME 类型 ('application/json' ) 不可执行,并且严格的 MIME 类型 che

javascript - 根据唯一ID确定是否推送或更新数组中的对象

javascript - onClick 不适用于选项字段

javascript - 将鼠标悬停在任一选择器上即可显示 div

javascript - Laravel Redirect::route 不起作用

jQuery/AJAX 图片上传插件?