1
"Live Meeting 시작"버튼이있는 ASP.NET MVC 페이지가 있습니다.ASP.NET MVC 페이지의 JQuery 타이머 플러그인
사용자가이 버튼을 클릭하면 문자열을 반환하는 "StartLiveMeeting"이라는 컨트롤러 메서드를 호출합니다.
컨트롤러가 빈 문자열을 반환하는 경우 문자열을 반환 할 때까지 타이머에서 Controller 메서드를 호출해야합니다. jquery.timer.js 플러그인을 사용 중입니다 (http://plugins.jquery.com/files/jquery.timers-1.2.js.txt)
버튼을 클릭 할 때 컨트롤러 메서드가 호출되고 있습니다. 그러나 Timer는 시작하지 않습니다. 컨트롤러 메소드를 호출하기 위해 5 초를 지정했습니다.
감사합니다. ASPX 페이지에
코드 :
//When "Start Meeting" button is clicked, if it doesn’t return empty string, Display that text and Stop Timer. Else call the Timer in every 5 sec and call the StartLiveMeeting Controller method.
$("#btnStartMeeting").click(function() {
var lM = loadLiveMeeting();
if (lM == "") {
$("#btnStartMeeting").oneTime("5s", function() {
});
} else {
$("#btnStartMeeting").stopTime("hide");
}
return false;
});
function loadLiveMeeting() {
$("#divConnectToLive").load('<%= Url.Action("StartLiveMeeting") %>', {}, function(responseText, status) {
return responseText;
});
}
<asp:Content ID="Content2" ContentPlaceHolderID="cphMain" runat="server">
<div id="divStartMeetingButton"><input id="btnStartMeeting" type="submit" value="Start Meeting" />
</div>
<div id = "divConnectToLive">
<div id="loading" style="visibility:hidden">
<img src="../../img/MedInfo/ajax_Connecting.gif" alt="Loading..." />
</div>
</div>
컨트롤러 방법 : 당신이 동기 확인해야합니다 하나 때문에
[HttpPost]
public string StartLiveMeeting()
{
int intCM_Id = ((CustomerMaster)Session["CurrentUser"]).CM_Id ;
var activeMeetingReq = (from m in miEntity.MeetingRequest
where m.CustomerMaster.CM_Id == intCM_Id
&& m.Active == true
select m);
if (activeMeetingReq.Count() > 0)
{
MeetingRequest meetingReq = activeMeetingReq.First();
return "<a href='" + meetingReq.URI + "'>" + "Connect to Live Meeting</a>";
} else {
return "";
}
}