Created
February 27, 2012 01:45
-
-
Save markdaws/1920625 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
status('Choose a file :)'); | |
// Check to see when a user has selected a file | |
var timerId; | |
timerId = setInterval(function() { | |
if($('#userPhotoInput').val() !== '') { | |
clearInterval(timerId); | |
$('#uploadForm').submit(); | |
} | |
}, 500); | |
$('#uploadForm').submit(function() { | |
status('uploading the file ...'); | |
$(this).ajaxSubmit({ | |
error: function(xhr) { | |
status('Error: ' + xhr.status); | |
}, | |
success: function(response) { | |
//TODO: We will fill this in later | |
} | |
}); | |
// Have to stop the form from submitting and causing | |
// a page refresh - don't forget this | |
return false; | |
}); | |
function status(message) { | |
$('#status').text(message); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment