how to get data exported to javascript

stfstf
edited December 2015 in JavaScript Mode

Hello -

I have a sketch that uses data from calls.txt in my /data directory. When I export this to javascript, calls.txt appears in the web-export folder, but the sketch displays a blank window in the browser.

I understand that processing.js doesnt have a /data directory. So how do I get a the contents of a file (/data/calls.txt) into a format that can be read by a Processing sketch exported to javascript? Do I have to convert it to .xml? Does loadStrings even work in javascript mode?

Processing 2.0b3 on a mac.

Any pointers greatly appreciated.

/stf

Tagged:

Answers

  • Hit F12 and check your browser console output. If testing with local files it could be a well documented browser security issue with loading local files...

  • edited December 2015 Answer ✓

    When using Processing load methods, don't explicitly request "data/" subfolder even in "Java Mode".
    For example: don't use loadStrings("/data/calls.txt");, just loadStrings("calls.txt");

Sign In or Register to comment.