Skip to content Skip to sidebar Skip to footer

Refreshing A Particular Div Content Using Javascript / Jquery

I have a JQuery div element. It displays a picture on the screen. The image is stored in the device memory and is being replaced in continuous interval (with same file name) Once t

Solution 1:

What you get from sdcard is a FILE_URI object such as (file://storage/emulated/0/Images/1.png) or you get DATA_URL object which is just the Base64 converted string of above.The html img tag accept FILE_URI and DATA_URL directly.

Solution 2:

Since cordova camera plugin just allow user to select a image to view/edit or click a image then we can use cordova file plugin to create a functioning gallery app.

add cordova file plugin to your project:

cordova plugin add cordova-plugin-file

Then create a handler to provide you the path of the images(Syntax):

window.resolveLocalFileSystemURL(cordova.file.dataDirectory, function (dirEntry) { console.log('file system open: ' + dirEntry.name); var isAppend = true; createFile(dirEntry, "fileToAppend.txt", isAppend); }, onErrorLoadFs);

For details of this plugin:https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file/

You can download test gallery app showing images from DCIM/Camera folder(default) into html img tag onto user screen:

https://drive.google.com/open?id=0B8vJcyO8_PK9R1k4STUyaEJQS1k

Post a Comment for "Refreshing A Particular Div Content Using Javascript / Jquery"