1

Ok so I know my question isn't worded very well so I'm going to do my best to describe my situation. I have a js file that needs to be in a separate folder than the rest of the program. I also need other users on the server to be able to update an array in that file and have the main html read that file. When I tried to update the file with notepad the changes didn't save. How can I accomplish this? Update

This is the original js file. I opened it in npp to try to edit the searchStrings array. enter image description here

Then I changed 'qwe' to 'ghost' and saved the file.

enter image description here

I copied the html full path and tested it in chrome. The code is supposed to trigger an alert if any of the searchStrings are entered in the box. When I typed the new word 'ghost' nothing happened. But it ran with the old 'qwe'.

enter image description here

I need anyone from my team to be able to edit the array from their computers. Note: all files are saved on a shared drive.

Emma B
  • 41
  • 4
  • Can you elaborate on what you mean by "When I tried to update the file with notepad the changes didn't save"? Assuming you're all editing the same file, yes you can automatically watch it and update on save. However, it's difficult to speak with certainty as I'm not entirely sure what you're asking. – Fissure King Jul 24 '18 at 17:13
  • When I updated the file with notepad and hit save the newly added word to my array didn't trigger my event listener but the old word did. – Emma B Jul 24 '18 at 17:15
  • Okay, let's get to the bottom of this. Can you update your question with the minimal amount of code to show what you are editing, displaying, etc.? (for some guidance, see [How to create a Minimal, Complete, and Verifiable Example](https://stackoverflow.com/help/mcve)). Second, it sounds like you're saying that the program did not respond to your change, not that the save itself was ineffective. Is that correct? Can you verify whether the saved file is still as you intended? – Fissure King Jul 24 '18 at 17:19
  • When I open the file the info I saved is there but the old info is what my event listener reads. – Emma B Jul 24 '18 at 17:35
  • After you save the changes in notepad, do you refresh the HTML page? Unless you refresh the html page, it will not load the changes in JS file. After reading your comment `When I updated the file with notepad and hit save the newly added word to my array didn't trigger my event listener but the old word did` I guess you are expecting the changes to reflect in html without refresh. That will not happen. – Vivek Athalye Jul 24 '18 at 17:36
  • Yes I am refreshing the page after every attempt. – Emma B Jul 24 '18 at 17:38
  • Ok. In that case please create a working sample where people can reproduce the issue, as suggested by Fissure King. – Vivek Athalye Jul 24 '18 at 17:43
  • https://jsfiddle.net/rurounisena/nz85x6uc/ – Emma B Jul 24 '18 at 17:52
  • Are you sure that the page is loading the JavaScript file from the shared drive and not somewhere else? How is the drive shared? (SMB share, Dropbox, etc?). Where is it in relation to the drive the HTML file is stored on? – Worthwelle Jul 24 '18 at 19:43

0 Answers0