dongyao9762 2014-03-17 12:47
浏览 58

在MySQL / PHP中使用FullCalendar保存客户端事件

I'm using FullCalendar and I want to save all events on form.submit() in MySQL database in a blob field. I thought I could convert it to JSON and then set it to a hidden input, then save it with PHP. But I get the JSON error for Converting circular structure to JSON.

Here is my code and the output.

$("input[type='submit']").click(function(e) {
    var events = $('#calendar-cabinet').fullCalendar( 'clientEvents');

    console.log(events);
});

result from console.log(events)

  • 写回答

1条回答 默认 最新

  • dongyuan1870 2014-03-17 13:04
    关注

    Is the input field that contains json also looped by the script that puts json in the input?

    Your data already shows javascript / json objects, so you should be able to post the events as array in an object, to have the events array available in $_POST['events'].

    $("input[type='submit']").click(function(e) {
        var events = $('#calendar-cabinet').fullCalendar( 'clientEvents');
        var url = 'your_url';
        var data = {events:events};
    
        $.ajax({
          type: "POST",
          url: url,
          data: data,
          success: success,
          dataType: dataType
        });
    });
    
    评论

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大