Can I use the add and load function in JQuery at the same time?

$(".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);
        }
    );

      

Is it possible to add the data I am loading to the details?

+3


source to share


2 answers


Sorry, just replace the element content with the result te.

You must do



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

      

+1


source


or you can do something like this:

$("#details").append($("<div id='appender1'></div>"));
$("#appender1").load("plugins/company_calendar/calendar.php?eventId="+ eventId +"&todo="+ todo +"&role="+ role );

      



of course you will need to count the addition if you need to use them more than once.

0


source







All Articles