I want to call jquery function (or something like that) from vb code.
This is what i need.
There is a VB function named Calculation(). It takes few seconds to complete the calculation. (Let's get it is taken 10 Seconds) In this 10 seconds the user don't know something is processing in behind. I want to add "spin" within this 10 seconds. Up to now I have code for start spin and stop spin using HTML button click event. ( http://html5-examples.craic.com/spin_js_example.html)
But It works when click the button. But I need to call it from VB code. You can understand My Problem properly from below pseudo code.
My vb code in Button click event
'In this place I should call jquery function which SPIN Start
Call Calculation() 'This takes 10 seconds for processing
'In here i want to stop SPIN
the code of ASP code
<html >
<head>
<style type="text/css" >
body {
font-family: Helvetica;
font-size:11pt;
padding:5px;
margin:0px
}
.centered {
text-align: center;
}
.spinner {
position: fixed;
top: 50%;
left: 50%;
}
</style>
<script src="spin.js" type="text/javascript"></script>
<script src="spin.min.js" type="text/javascript"></script>
<script src="jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
var opts = {
lines: 11, // The number of lines to draw
length: 15, // The length of each line
width: 10, // The line thickness
radius: 30, // The radius of the inner circle
corners: 1, // Corner roundness (0..1)
rotate: 0, // The rotation offset
direction: 1, // 1: clockwise, -1: counterclockwise
color: '#000', // #rgb or #rrggbb
speed: 0.6, // Rounds per second
trail: 60, // Afterglow percentage
shadow: false, // Whether to render a shadow
hwaccel: false, // Whether to use hardware acceleration
className: 'spinner', // The CSS class to assign to the spinner
zIndex: 2e9, // The z-index (defaults to 2000000000)
top: 'auto', // Top position relative to parent in px
left: 'auto' // Left position relative to parent in px
};
var spinner = null;
var spinner_div = 0;
$(document).ready(function() {
spinner_div = $('#spinner').get(0);
$("#button1").click(function(e) {
e.preventDefault();
if(spinner == null) {
spinner = new Spinner(opts).spin(spinner_div);
} else {
spinner.spin(spinner_div);
}
});
$("#button2").click(function(e) {
e.preventDefault();
spinner.stop(spinner_div);
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div id='spinner' class='spinner'></div>
<input type="button" id="button1" value="START" />
<input type="button" id="button2" value="STOP" />
<asp:Button ID="cmd_cal" runat="server" Text="Button" Width="70px" />
</form>
</body>
</html>
Please show me some direction for doing this....