How do I save/update a local project file with ajax?

0 favourites
  • 3 posts
From the Asset Store
"Easy Local Notifications" enhances games with customizable local notifications.
  • Hello

    I want to save/update a local project file, txt or csv. This tutorial: ajax objects explains how to open data with ajax locally by importing the file to project files and using the file name as a URL in the ajax request. But I can't find how to update the file in runtime? or do I need to have the file online with a php script to be able to send the ajax request?

    The plan is to build a replay system and export the data as a separate file.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi risto,

    you possibly could mix NWjs in ( https://www.scirra.com/manual/162/nwjs ) which is capable of writing data to a local (or remote-connected) storage medium. Using NWjs would force you to get away from AJAX write operations since it only reads data in this constellation.

    Otherwise you could setup a local dev-environment, using your local Node/PHP/whatever back-end for debugging purposes (depending on "what" you want to achieve in your prod-environment). There are some toolkits which feature out-of-the-box configurations (depending on your OS).

    Haven't worked for quite some time with C2, but I think just throwing out a *.JSON (or of course *.CSV or *.TXT or [...]) would be the easiest option since vanilla HTML is capable of saving files (in other words: ready up the content to be saved and trigger a file-download).

    Have a great day,

    Proxy

  • you possibly could mix NWjs in ( https://www.scirra.com/manual/162/nwjs ) which is capable of writing data to a local (or remote-connected) storage medium. Using NWjs would force you to get away from AJAX write operations since it only reads data in this constellation.

    Thanks! I have exported to NW.js before but I didn't realise that it was possible to use a object with extra commands. Create file and Append file is exactly what I wanted <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)