Asp.net Jquery Ajax 執行個體

來源:互聯網
上載者:User
jquery 庫最新版下載:jquery-1.4.2min.js

jquery 1.3.2mini版:jquery-1.3.2min.js

中文手冊下載地址(超酷版):jquery12api

前台代碼:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ajax.aspx.cs" Inherits="ajax" %>  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">    <html xmlns="http://www.w3.org/1999/xhtml">  <head runat="server">      <title>Jquery Ajax執行個體</title>      <mce:script type="text/<a href="http://lib.csdn.net/base/javascript" class='replace_word' title="JavaScript知識庫" target='_blank' style='color:#df3434; font-weight:bold;'>JavaScript</a>" src="script/jquery-142min.js" mce_src="script/jquery-142min.js"></mce:script>      <mce:script type="text/javascript"><!--  $(function() {      $("#dbtn").click(function(){          $.ajax({                 type: "POST",                 //dataType:"Text",                 url:"Handler.ashx",                 data:{name:"admin",pass:"admin"},                 beforeSend:function(){                 $("#ds").html("loading");                 },                 success: function(msg){                  $("#ds").html("<p>"+msg+"</p>");                 }          });                     });  });  // --></mce:script>  </head>  <body>      <form id="form1" runat="server">      <div>      <div id="ds"><p>我是AJAX原來的文字!</p></div>      <input type="button" value="提交AJAX<a href="http://lib.csdn.net/base/softwaretest" class='replace_word' title="軟體測試知識庫" target='_blank' style='color:#df3434; font-weight:bold;'>測試</a>" id="dbtn" name="dbtn" />      </div>      </form>  </body>  </html>

Handler.ashx:

<%@ WebHandler Language="C#" Class="Handler" %>    using System;  using System.Web;  using System.Data.SqlClient;    public class Handler : IHttpHandler {            public void ProcessRequest (HttpContext context) {          context.Response.ContentType = "text/plain";                    //context.Response.Write("Hello World");          if (context.Request["name"].ToString() == "admin" && context.Request["pass"].ToString() == "admin")          {              context.Response.Write("Y");          }          else          {              context.Response.Write("N");          }      }      public bool IsReusable      {          get          {              return false;          }      }        }


更多Asp.net Jquery Ajax 執行個體關文章請關注topic.alibabacloud.com!

  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.