Monday, 4 August 2014

jquery loading spinner


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="https://code.jquery.com/jquery.js" type="text/javascript"></script>
<script>
$(document).ready(function () {
$('#save').click(function () {
$('#loading').html('<img src="loading.gif">');
//Start your business logic
//Below code is not correct, just want to wait my process inside this code, so that we can see loading image..
for (var i = 0; i < 1000; i++) {
if (i == 1000) {
$('#loading').hide();
$('#dvOutPut').html(i);
}
}
//End business logic
});
});
</script>
</head>
<body>
<div id="loading"></div>
<div id="dvOutPut"></div>
<input id="save" value="Save" type="button" />
</body>
</html>
view raw gistfile1.html hosted with ❤ by GitHub