<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> <br> <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("正在查询"); <BR>}, <BR>success: function(msg) { <BR>$('#show').text(eval("(" + msg + ")").d); <BR>}, <BR>error: function(xhr, msg, e) { alert(msg); } <BR>}); <BR>} <BR></script> <br> <br> <br><form id="form1" runat="server"> <br><div id="click" onclick="show('执行成功');">点击我! </div> <br><div id="show"></div> <br> </form> <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> <div class="codebody" id="code9069"> <br>[System.Web.Services.WebMethod()] <br>public static string aa(string str) <br>{ <br>return str; <br>} <br> </div>