Reputation: 108
i'm trying to add picture on my server with jquery mobile and php on a cordova project for android.
When i select a picture from my librairie or i make a capture, the app restart instead of refreshing my form with the picture.
here is my html code:
<button onclick="capturePhoto();">Capture Photo</button>
<button onclick="getPhoto(pictureSource.PHOTOLIBRARY);">From Photo Library</button>
here is my jquery mobile code:
function capturePhoto() {
navigator.camera.getPicture(onPhotoDataSuccess, onFail, {
quality: 50,
targetWidth: 600,
targetHeight: 600,
destinationType: destinationType.FILE_URI,
encodingType:navigator.camera.EncodingType.JPEG,
saveToPhotoAlbum: true
});
}
function getPhoto(source) {
navigator.camera.getPicture(onPhotoURISuccess, onFail, {
quality: 50,
targetWidth: 600,
targetHeight: 600,
destinationType: destinationType.FILE_URI,
encodingType:navigator.camera.EncodingType.JPEG,
sourceType: source
});
}
I've searched everywhere but i can't find any solution.
EDIT, i have the last version of cordova and the last of file plugin
Upvotes: 0
Views: 393
Reputation: 108
By luck, i've tried to change the html code, just in case, and here is the solution:
I just change this code:
<button onclick="capturePhoto();">Capture Photo</button>
to this:
<a href="" class="ui-btn" onclick="capturePhoto();">Capture Photo</a>
Don't use html buttons tag, use anchor tag... don't know why but this worked !!!
Upvotes: 1