Question

I am currently trying to read the content from a file saved in a WebDav directory. I am using the library xhrdavclient and there is also a method called 'read' in this library. I just don't know where I can get the content from after reading, because the only documentation to this method I can find is that one: xhrdavclient reference

The code I use at the moment is just:

fs.getRequest().read('/path/to/file.ending'); //fs = xhrdav.DavFs.getInstance()

I tried to debug the code and tried some other possible parameters, too, but I do not know how to get the text in my file in a variable. I am also new in JavaScript so I don't know much about those 'onXhrComplete' callback functions, for example. Can you help me?

Was it helpful?

Solution

The second argument of the read method is the 'handler' function, i would expect you should provide a function here which will be called with the data.

Note, however, that 'reading the content from a file saved in a webdav directory' is just a normal GET request so you dont need a special dav library. You could for example use the jquery get method:

$.get( "ajax/test.html", function( data ) { $( ".result" ).html( data ); alert( "Load was performed." ); });

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top