Hi I have a form that includes an Ajax image uploader, its working fine on desktop but when I try my mobile it causes the page to refresh after the image is selected and the image is lost (not to mention other bits of jquery I have set to run on complete of the upload).
I have found this link Android browser refreshes page after selecting file via input element and although it provides an explanation I can see there is no solution offered. That post was more than a year ago and I havent found any other solutions online.
There must be a workaround as I can see it working on other sites, e.g. http://www.putmeinthestory.com/
Code:
<form action="index.php?route=product/product/image_upload" onSubmit="return false" method="post" enctype="multipart/form-data" class="MyUploadForm">
<input name="FileInput" id="FileInput" type="file" /><br />
<input type="submit" id="submit-btn" value="Upload File »" />
</form>
<div id="output"></div>
Javascript: Im not sure if posting all the functions being called below is relevant to the issue.
var options = {
target: '#output', // target element(s) to be updated with server response
beforeSubmit: beforeSubmit, // pre-submit callback
success: afterSuccess, // post-submit callback
uploadProgress: OnProgress, //upload progress callback
resetForm: true // reset the form after successful submit
};
jQuery('.MyUploadForm').submit(function() {
$(this).ajaxSubmit(options);
return false;
});