I am trying to get setInterval working while a file uploads.
My html:
<form action="test.php" method="POST" enctype="multipart/form-data" id='jimbo'>
<input type="hidden" name="<?=ini_get('session.upload_progress.name'); ?>" value="myupload" />
<input type="file" name="file1" />
<input type="submit" id='submitme' />
</form>
Please ignore the php session upload part of this question, that is all functioning correctly. My problem is with the jQuery. I want the setInterval() to run whilst the form is uploading. But I cannot figure out how to write that in jQuery. This is what I have:
$(document).ready(function () {
$("#jimbo").submit(function () {
setInterval(function() {
$.ajax({
url: "ajx.php",
success: function (data) {
$("#feedback").html(data + Math.random(999));
}
});
//$("#feedback").html("hello " + Math.random(999));
},500);
//return false;
});
});
If I leave return false;
in there, i get the output but no file uploading. If I remove it, I get the file uploading but no output. How can I have both ?