doupinyan0186 2016-08-09 11:09
浏览 32
已采纳

我正在尝试从mysql db获取日期到fullcalendar.js事件

i have a table in my database named as employee_leaves,have fields like starting date and ending date i want to fetch those dates and display them dynamically on full calender so far i have done this but everytimes the alert is executed alerting the error...

    $(document).ready(function() {
      var calender= $('#cal').fullCalendar({

        events: {
        url:"events.php",
        type:"POST",
        error: function() {
            alert('There was an error while fetching events.');
        }
     }
        })

       });

this is my events.php file

  $sql_get_leaves="SELECT * from employee_leaves";
$query_leaves=mysql_query($sql_get_leaves);
$events-array();
$res=mysql_fetch_array($query_leaves);
    $e=array();
    $e['id']="Leave_1";
    $e['title']="Leave";
    $e['start']=$res['leave_starting_date'];
    $e['end']=$res['leave_ending_date'];
    $e['allDay']=false;
    array_push($events,$e);
    echo json_encode($events);
  • 写回答

1条回答 默认 最新

  • dongyu2047 2016-08-09 11:19
    关注

    Check the code properly. For ( = ) you have written as ( - ) Change and try:-

    $events = array();
    

    And also add the success function in our javascript function.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何实验stm32主通道和互补通道独立输出
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题