Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.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
Android Phonegap缓存JSON?_Android_Jquery_Cordova - Fatal编程技术网

Android Phonegap缓存JSON?

Android Phonegap缓存JSON?,android,jquery,cordova,Android,Jquery,Cordova,我正在测试一个简单的脚本以获得更大的解决方案;Im从外部JSON文件检索信息并在PhoneGap应用程序中显示。脚本可以根据需要工作,除非我更改外部JSON文件的内容(而不是结构)。事实上,我甚至可以从服务器中删除JSON文件,脚本仍然显示原始JSON内容。显然有东西在某处。有没有办法禁用这种功能 顺便说一句,我通过USB调试在本地设备上运行,而不是模拟器 以下是代码(控制台日志用于通过浏览器进行早期调试): 看起来我可以使用缓存:false。希望有人觉得这有帮助 <!DOCTYPE ht

我正在测试一个简单的脚本以获得更大的解决方案;Im从外部JSON文件检索信息并在PhoneGap应用程序中显示。脚本可以根据需要工作,除非我更改外部JSON文件的内容(而不是结构)。事实上,我甚至可以从服务器中删除JSON文件,脚本仍然显示原始JSON内容。显然有东西在某处。有没有办法禁用这种功能

顺便说一句,我通过USB调试在本地设备上运行,而不是模拟器

以下是代码(控制台日志用于通过浏览器进行早期调试):


看起来我可以使用缓存:false。希望有人觉得这有帮助

<!DOCTYPE html>

<html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="msapplication-tap-highlight" content="no" />
        <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
        <link rel="stylesheet" type="text/css" href="css/index.css" />
        <title>Hello World</title>
    </head>
    <body>
        <div class="app">
<script>
$( document ).ready(function() {
    console.log( "ready!" );
});      

$.getJSON( "http://www.serverxyz.com/test.json", function( data ) {
  var items = [];
  $.each( data, function( key, val ) {
    items.push( "<li id='" + key + "'>" + val + "</li>" );
  });

  $( "<ul/>", {
    "class": "my-new-list",
    html: items.join( "" )
  }).appendTo( "body" );
});
</script>
        </div>
        <script type="text/javascript" src="cordova.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
        <script type="text/javascript">
            app.initialize();
        </script>
    </body>
</html>
{
  "Goal One": "Activity One Completed",
  "Goal Two": "Activity Two Completed",
  "Goal Three": "Activity Three Completed",
}