这是在click事件上调用web方法。但我得到错误作为inernal服务器错误。这里是从动态创建的按钮调用此单击事件。这是带有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;
}