I have a problem that I hope someone can help me with. I am using the Intel XDK with jQuery and Cordova. I do not unfortunately know which versions they are because I can't see it but the XDK has just update so I believe it is the newest versions whatever they are. I added a html file that I am working with at the moment to read a text file and eventually save to a database but for now to get it working I just want to place the contents in a div. I am using an input type="file" as below to select the file from the directory.
My code is in the index.html file (attached) and the input and div is in the other html file. My problem is lying where I get the file. I have put alerts before and after and I also have two versions of reading the file. the readText function is doing the jQuery.get or at the moment $.get and just absolutely nothing happens. The readFile function gives me an error: Uncaught TypeError: Cannot read property '0' of undefined index.html line 143.
var Importer = {
init: function() {
var me = this
$("#btnImport").bind("tap", function(e) {
//me.readText()
me.readFile()
});
},
readText: function() {
if (window.File && window.FileReader && window.FileList && window.Blob) {
jQuery Mobile read a text file
in JavaScript
Posted
Hallo all,
I have a problem that I hope someone can help me with. I am using the Intel XDK with jQuery and Cordova. I do not unfortunately know which versions they are because I can't see it but the XDK has just update so I believe it is the newest versions whatever they are. I added a html file that I am working with at the moment to read a text file and eventually save to a database but for now to get it working I just want to place the contents in a div. I am using an input type="file" as below to select the file from the directory.
My code is in the index.html file (attached) and the input and div is in the other html file. My problem is lying where I get the file. I have put alerts before and after and I also have two versions of reading the file. the readText function is doing the jQuery.get or at the moment $.get and just absolutely nothing happens. The readFile function gives me an error: Uncaught TypeError: Cannot read property '0' of undefined index.html line 143.
index.html