<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><제목></제목> <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>유형: "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("正재查询") <br>}, <br> 성공: 함수(msg) { <br>$('#show').text(eval("(" msg ")").d) <br>}, <br>오류: 함수(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="show" ></div> <br></form> <br></body> <br></html> <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> <div class="codebody" id="code9069"> <br> [System.Web.Services.WebMethod()] <br>public static string aa(string str) <br>{ <br>return str; <br>} <br> </div>