Solved
How to read and write files with javascript?
Hi all,
I want to read and write files with javascript. The file might be stored in javascript files library, or in a remote server.
What I am looking for is to read and update some values when each participant start the survey. These are global values, so embedded data will not work.
Thanks for your help.
Best answer by Anonymous
Hello @rakib062 ,
You can read files with js but make sure that you do that part in the "look and feel" -> "Advanced" -> "Header"(edit)-> "<>" HTML view inside "`<script>`" tag.
Since this header script will run every time when new page is loaded in the survey and data can be accessible throughout the survey.
Following code will fetch the data of file(present on the same server i.e in qualtrics files library)
`jQuery.get('//File URL', function(result) {console.log("File Contains -"+result);});`
If you are using remote file for read and write operation, then you need to have an api at server side i.e where remote file is hosted (as mentioned by @AnthonyR ) and then using web-service element of survey flow you can read or write the data in remote file.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
