I have the following code:
$("#scheduleLink").trigger("click");
alert("text")
This is the click handler:
$("#scheduleLink").bind("click", (function () {
loadScheduleEvent();
$(".wrap_tabs").find("a").removeClass("active");
$(this).addClass("active");
}));
and loadScheduleEvent function:
function loadScheduleEvent() {
var eventId = $(".movie").attr("eventId");
var type = $(".movie").attr("type");
$("#publicationBlockContent").load("/Publication/EventSchedule?eventId=" + eventId + "&type=" + type);
}
I suppose that this code work async. I want that alert("text") calls only when loadScheduleEvent is finished. How can I do this?
Thanks.
UPDATE:
In fact, instead of alert("text") there is some code. And, I can't move this code to callback of $.load function.
loadScheduleEvent()is finished (almost) immediately. You want the alert when$.load()is finished.$.loadis finished. But, I can't move alert(in fact there is other code) to callback of$.loadfunction.