<div class="codetitle"> <span><a style="CURSOR: pointer" data="17354" class="copybut" id="copybut17354" onclick="doCopy('code17354')"><u>复制代幣</u></a></span>代码如下:</div> <div class="codebody" id="code17354"> <br><html xmlns="http://www.w3.org /1999/xhtml"> <BR><head runat="server"> <br><title></title> <br><script src="script/jquery-1.3.2.js" type="text/jscript"></script> <br><script type="text/jscript"> <br>function show(num) { <br>var params = '{str:"' num '"}'; <br>$.ajax({ <br>type: "POST", <br>url: "default.aspx/aa", <br>data: params, <br>dataType: "text", <br>contentType : "application/json; charset=utf-8", <br>beforeSend: function(XMLHttpRequest) { <br>$('#show').text("正在查询");成功: function(msg) { <br>$('#show').text(eval("(" msg ")").d); <br>}, <br>エラー: function(xhr, msg, e) { アラート(メッセージ) } <br>}); <br>} <br></script> <br></head> <br> <br><form id="form1" runat="server"> <br><div id="click" onclick="show('执行成功');">点击我! </div> <br><div id="表示" ></div> <br></form> <br></body> <br></html> <br><br> <br>後台方法: </div> <br><br><div class="codetitle"> <span>复制代<a style="CURSOR: pointer" data="9069" class="copybut" id="copybut9069" onclick="doCopy('code9069')"><u></u>代码如下:</a></span> </div> [System.Web.Services.WebMethod()] <div class="codebody" id="code9069">public static string aa(string str) <br>{ <br>return str; <br>} <br><br> </div>