CopyCode The Code is as follows: <HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> </title>
<SCRIPT src = "script/jquery-1.3.2.js" type = "text/JScript"> </SCRIPT>
<SCRIPT type = "text/JScript">
Function show (Num ){
VaR Params = '{STR: "' + num + '"}';
$. Ajax ({
Type: "Post ",
URL: "default. aspx/AA ",
Data: Params,
Datatype: "text ",
Contenttype: "application/JSON; charset = UTF-8 ",
Beforesend: function (XMLHttpRequest ){
$ ('# Show'). Text ("querying ");
},
Success: function (MSG ){
$ ('# Show'). Text (eval ("(" + MSG + ")"). d );
},
Error: function (xhr, MSG, e) {alert (MSG );}
});
}
</SCRIPT>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div id = "click" onclick = "show ('execution successfully');"> click me! </Div>
<Div id = "show"> </div>
</Form>
</Body>
</Html>
Background method:Copy codeThe Code is as follows: [system. Web. Services. webmethod ()]
Public static string AA (string Str)
{
Return STR;
}