Javascript 使用返回json的ajax加载完整日历事件
我尝试过遵循这个示例,但为了json响应修改了它 ajax调用成功返回一个事件对象数组,但是数组上的回调返回错误Javascript 使用返回json的ajax加载完整日历事件,javascript,jquery,ajax,fullcalendar,Javascript,Jquery,Ajax,Fullcalendar,我尝试过遵循这个示例,但为了json响应修改了它 ajax调用成功返回一个事件对象数组,但是数组上的回调返回错误 Uncaught TypeError: undefined is not a function 下面是我的代码 events: function(start, end, callback) { jQuery.post( MyAjax.ajaxurl, { action : 'myajax-submit', data: {
Uncaught TypeError: undefined is not a function
下面是我的代码
events: function(start, end, callback) {
jQuery.post(
MyAjax.ajaxurl,
{
action : 'myajax-submit',
data: {
request: "tasks"
},
postID : MyAjax.postID
},
function( response ) {
callback(response);
}
);
},
非常感谢您的帮助
Alex发布更多代码。很可能您没有定义MyAjax.postID,或者在调用时没有传入回调。ajax调用工作正常,响应包含事件对象数组。你是对的,问题在于回调,因为我不理解它们。在我的代码中,我没有在其他地方提到这个回调函数。这个函数需要一个回调参数,这个回调函数将在ajax调用返回时被调用。该回调函数将接受ajax响应,并对其执行所需操作。您需要将该函数作为其第三个参数传递到此事件函数中。重复: