Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/441.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用返回json的ajax加载完整日历事件_Javascript_Jquery_Ajax_Fullcalendar - Fatal编程技术网

Javascript 使用返回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: {

我尝试过遵循这个示例,但为了json响应修改了它

ajax调用成功返回一个事件对象数组,但是数组上的回调返回错误

 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响应,并对其执行所需操作。您需要将该函数作为其第三个参数传递到此事件函数中。重复: