<script src=”http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript"></script>
<script language="javascript">
$(document).ready(function() {
$("# btnGetName ").click(function() {
$.ajax({
type: "POST",
url: “../Default.aspx/GetName",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
$("# divName ").html(msg.d);
}
});
});
$("# loading ").ajaxStart(function() {
$(this).show();
});
$("# loading ").ajaxStop(function() {
$(this).hide();
});
});
</script>
<pre>
</pre>
<body>
<form id="form1" runat="server">
<div id="loading" align="center" style="padding-right: 25px; z-index: 3; padding-left: 25px;
left: 45%; top: 45%; padding-bottom: 15px; padding-top: 15px; position: absolute;">
<img alt="Loading..." id="ImgLoader" runat="server" src="loader.gif" />
</div>
<div id="divName"></div><input id="btnGetName" type="button" value="Get Name" /></div>
</form>
</body>
No comments :
Post a Comment