Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/245.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/68.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
Php 日历未检索本地存储数据_Php_Jquery_Json_Jquery Mobile - Fatal编程技术网

Php 日历未检索本地存储数据

Php 日历未检索本地存储数据,php,jquery,json,jquery-mobile,Php,Jquery,Json,Jquery Mobile,尝试使用localstorage(基于上的日历)设置支持脱机查看的事件日历 我已设法将所有数据存储在我的localstorage中,如下所示,但当尝试脱机加载日历时,它无法加载。有什么想法吗?我需要尽快完成此操作:-) JSON 日历(在线) 日历(脱机) 不知道从这里到哪里去。我试过以下方法 (JSON.parse(localStorage.getItem(“calendar_items”))但这也不起作用。您的代码有语法错误,只需查看语法突出显示。此外,尝试用jsonData替换“脱机模式”

尝试使用localstorage(基于上的日历)设置支持脱机查看的事件日历

我已设法将所有数据存储在我的localstorage中,如下所示,但当尝试脱机加载日历时,它无法加载。有什么想法吗?我需要尽快完成此操作:-)

JSON

日历(在线)

日历(脱机)

不知道从这里到哪里去。我试过以下方法


(JSON.parse(localStorage.getItem(“calendar_items”))但这也不起作用。

您的代码有语法错误,只需查看语法突出显示。此外,尝试用
jsonData
替换“脱机模式”的
localStorage.getItem()
返回对象,而不是文件名)在在线日历中记录并解决。我编辑了完整的路径,无意中删除了字符。然而,我要问的是离线代码:-)对不起,我不懂。如果它是离线的,我不会只通过localstorage查找数据项而不是文件名吗?正如我从插件的内联json示例页面中看到的,如果您有原始json数据而不是文件名,那么您应该通过
jsonData
选项将此数据发送给插件。您的
localStorage.getItem('calendar\u items')
将返回原始json数据
$.getJSON("dates.json.php", function(data) {
                 calendar_items = data;
                 localStorage.setItem("calendar_items", JSON.stringify(calendar_items));

which stores...

[{"date":"2014-02-04 00:00:00","type":"event","title":"Test","url":"","id":"361"},{"date":"2014-02-05 00:00:00","type":"event","title":"Test 2","url":"","id":"361"},{"date":"2014-02-06 00:00:00","type":"event","title":"Test 3","url":"","id":"361"}]
$("#eventCalendarHumanDate").html();
$("#eventCalendarHumanDate").eventCalendar({
    eventsjson: "dates.json.php",
    jsonDateFormat: 'human'
});
$("#eventCalendarHumanDate").html();
$("#eventCalendarHumanDate").eventCalendar({
    eventsjson: localStorage.getItem("calendar_items"),
    jsonDateFormat: 'human'
});