<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Website1.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script lang="javascript" src="JQuery.js" type="text/javascript"></script>
<script lang="javascript">
function chk()
{
$.ajax (
{
type: "POST",
url: "WebForm1.aspx/show", // show is the name of function
data: "{}",
contentType: "application/json; charset=utf-8",
dataType:"json",
async: true,
cache: false,
success: function (msg)
{
$('#div1').text(msg.d);
},
error: function (x, e)
{
alert("The call to the server side failed. " + x.responseText);
}
});
return false;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="div1" style="width:500px; height:40px; background-color:aqua">
This is hidable.
</div>
<div>
<asp:TextBox ID="Text" CssClass="abc" Text="" runat="server"></asp:TextBox>
<asp:Button ID="btnShow" OnClientClick="return chk();" runat="server" OnClick="btnShow_Click" Text="Javascript" />
</div>
</form>
</body>
</html>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script lang="javascript" src="JQuery.js" type="text/javascript"></script>
<script lang="javascript">
function chk()
{
$.ajax (
{
type: "POST",
url: "WebForm1.aspx/show", // show is the name of function
data: "{}",
contentType: "application/json; charset=utf-8",
dataType:"json",
async: true,
cache: false,
success: function (msg)
{
$('#div1').text(msg.d);
},
error: function (x, e)
{
alert("The call to the server side failed. " + x.responseText);
}
});
return false;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="div1" style="width:500px; height:40px; background-color:aqua">
This is hidable.
</div>
<div>
<asp:TextBox ID="Text" CssClass="abc" Text="" runat="server"></asp:TextBox>
<asp:Button ID="btnShow" OnClientClick="return chk();" runat="server" OnClick="btnShow_Click" Text="Javascript" />
</div>
</form>
</body>
</html>
No comments:
Post a Comment
Your comment is pending for approval