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

        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());


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


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) {




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.



All Articles