Hi, Have you tried your plugin with a vanilla TW? If you use a customized version may be readOnly is set somewhere else again.
Have you tried displayMessage() instead of alert(). Or console.log() if available. What is, if data is not equal to value1 nor to value2? regards Mario On Mar 12, 1:34 pm, gkdev <[email protected]> wrote: > Hi, > I'm a new tiddlywiki user and developer trying to write my first > plugin. I'm serving the tiddlywiki over http and the plugin needs to > fetch a value from the server which if it is equal to "value1" causes > the plugin to set readOnly = true and if it is equal to "value2" > causes readOnly = false. The plugin makes the server call as soon as > the tiddlywiki is loaded and receives the data correctly, but for some > reason readOnly is not set correctly. The code is below: > > //this is the callback function from the Ajax call: > function processServerData(data) { > alert(data); //this returns the correct value > if(data == "value1") { > //put tiddlywiki in read-only mode: > readOnly = true; > } > if(data == "value2") { > readOnly = false; > } > alert(readOnly); //does NOT return correct value based on the > above if statements > > } > > I keep on getting that readOnly == true which is very strange. By the > way, I have config.options.chkHttpReadOnly = false; > Can anyone help? -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/tiddlywikidev?hl=en.
