1 Reply Latest reply on Sep 20, 2016 3:22 PM by Chris W. Griffith

    Error 404 while posting data to local file

    kasjuszek

      Hello

       

      In project's www folder I have app.xml file with some data deserialized during application start. I use jQuery GET to read settings like in example:

      $.get("app.xml", function(data){

          $("#mac").val($(data).find('macAddress')[0].innerHTML);

        });

       

      The issue begins with trying to serialize new data back to the file. The simplest way is to use POST method (I tried also XMLHttpRequest and FileWriter):

      $.post("app.xml", function(data){

              $(this).find('files').append(data);

      });

       

      When i run this function, console responds with some kind of access problem (while get works fine):

      POST http://192.168.1.11:3000/app.xml 404 (Not Found) send @ jquery-2.1.4.js:8630ajax

       

      I've read about similar problems, the solution was always cordova whitelist plugin. In my case it did not work, neither in browser, nor in android app.

      config.xml:

      <plugin name="cordova-plugin-whitelist" source="npm" spec="~1.2.1"/>

      (...)

      <access origin="*"/>

        <allow-intent href="*" />

        <allow-navigation href="*" />

        <platform name="android">

          <allow-intent href="*"/>

        </platform>

       

      It looks to me that I miss some data write privileges, but it's weird to me, that it doesn't work even in browser. How should I properly store program settings?