jquery - Using Javascript/PhoneGap to access a txt file on server -


this question has answer here:

i trying access text file (stored on server) storing coordinates in order parse , store in phonegap application. i'm new javascript, possible do? i've searched around while , can't seem figure out on own. appreciated.

thanks, molly

you can use xmlhttprequest fetch text, assuming text file publicly accessible. use like:

var req=new xmlhttprequest(); req.open("get", "txt_file_url", true); req.onreadystatechange=function () {     if (req.readystate==4) {         var txt=req.responsetext;         // text     } }; req.send(); 

unfortunately, asynchronous; if need synchronous way, try using async.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -