We have a single page app and we have a divs for each page like this:
<div id="page1">
</div>
<div id="page2">
</div>
In page2 I have a button to get the image from the gallery and this is my code to get image:
function getPhoto() {
navigator.camera.getPicture(onPhotoURISuccess, onFail, {
destinationType: Camera.DestinationType.FILE_URI,
quality: 30,
sourceType: Camera.PictureSourceType.SAVEDPHOTOALBUM
});
}
function onPhotoURISuccess(imgURI) {
}
But the problem is after getting image, the page is getting refreshed because of that entire page is reloaded and it is coming to page1 div (the initial div which we show). My question is how can I prevent cordova from refreshing the page? Since after capturing the image I want to convert it to a base64 data so I cannot avoid onPhotoURISuccess()
event. Can anyone help me or give me some hints to override this behaviour?