我从使用 Getjson IOS 读取 Cordova 中 excist 的文件中得到 404

问题描述

var plathform = device.platform;
alert (plathform);
if (plathform === 'Android') {
    var path = cordova.file.externalRootDirectory + ".vBoxxTasks/notes/";
}
else
{
    var url = location.search;
    path = cordova.file.documentsDirectory + "vBoxxTasks/notes/" + url.replace(/[?]/g,"");
    testpath = cordova.file.dataDirectory;
    alert(testpath);
    alert('de path naar je folder is:')
    alert (path);
}
    
     alert(url);
    var filename = (url.replace(/[?]/g,""));
   var bestand = "test.json";
    var naam = filename;
    //var obj = JSON.parse(path)
   // alert(obj);
    alert(naam);

    var fullp = path + naam;
    alert(filename);
    alert(fullp);
    
    
    alert('kajhsdkja')
    
    $.getJSON(path,function(json){
     alert("lets read your json");
     alert(JSON.stringify(json));
     
     })
    .fail(function(e) { alert("ERROR: " + JSON.stringify(e)) })
    .complete(function() { "ajshdakjhdakjhdkaj" })
}

function readDirfail(e) {
alert("FileSystem Error");
console.dir(e);
}

**上面你看到了我的脚本代码,我使用cordova插件文件来存储文件文件保存在正确的文件夹中并且目录存在但是当我读取json时我收到404错误并且我不知道为什么**

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)