Function to easily submit forms with file uploads using AJAX in jQuery Mobile. Not all browsers support file uploads via AJAX!
<form action="upload.php" method="post" enctype="multipart/form-data" id="myForm">
<input type="file" name="my_file" id="my_file">
</form>
<script>
$('form#myForm').on('submit', function(event) {
$.mobile.ajaxUpload.changePage(this);
return false; // prevent regular submit
});
</script>
This code has been tested with jQuery 1.9.1 and jQuery Mobile 1.3.2 in Safari on Mac.
This code is licensed under MIT license.