这是在单击事件上调用 Web 方法。但我得到的错误是内部服务器错误。这里从动态创建的按钮调用这个点击事件。这是带有 c# 代码的 asp.net
<script type="text/javascript">
$(document).ready(function () {
$('#contaner_wrapper').css("height", "100%");
$(document).on('click', '.fc-button-prev a span', function () {
//alert($("#calendar").fullCalendar('getView').start.toString());
var abc = $("#calendar").fullCalendar('getView').start.toString();
var ab = $("#calendar").fullCalendar('getView').end.toString();
//PageMethods.EventDetails('E72', onSucess, onError);
$.ajax({
url: 'ViewEvents.aspx/Displaymonthevents',
type: 'POST',
data: 'hi',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (data) {
alert(data.d);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(errorThrown);
}
});
$(document).on('click', '.fc-button-next a span', function () {
// Displaymonthevents();
alert($("#calendar").fullCalendar('getView').start.toString());
var abc = $("#calendar").fullCalendar('getView').start.toString();
var ab = $("#calendar").fullCalendar('getView').end.toString();
jQuery.ajax({
url: "ViewEvents.aspx/EventDetails",
type: "POST",
data: "hi",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
alert(data.d);
}
});
});
$(".fc-button-prev a span").trigger('click');
$(".fc-button-next a span").trigger('click');
});
</script>` [System.Web.Services.WebMethod(EnableSession = true)]
public List<Events> Displaymonthevents(string eventdata1)
{ List<Events> events; return events;
}