<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      Jquery異步請求數據實例

      一、Jquery向aspx頁面請求數據

      前臺頁面JS代碼:

                  $("#Button1").bind("click", function () {
                      $.ajax({
                          type: "post",
                          url: "default.aspx",
                          data: "name=" + $("#Text1").val(),
                          success: function (result) {
                              alert(result.msg);
                          }
                      });
                  });

       

      <input id="Text1" type="text" value='張三'/>
              <input id="Button1" type="button"  value="提交" />

       

      后臺cs代碼:

      View Code
          protected void Page_Load(object sender, EventArgs e)
          {
              if (Request["name"]!=null)
              {
                  Response.ContentType = "text/json";
                  Response.Write("{\"msg\":\""+Request["name"]+"\"}");//將數據拼湊為Json
                  Response.End();
              }
          }

      二、Jquery向WebService頁面請求數據

                  $("#Button2").bind("click", function () {
                      $.ajax({
                          type: "post",
                          contentType: "application/json",
                          url: "WebService.asmx/HelloWorld",
                          data: "{name:'" + $("#Text1").val() + "'}",
                          datatype: "json",
                          success: function (result) {
                              alert(result.d);
                          }
                      });
                  });
       <input id="Button2" type="button"  value="向WebService提交" />

      WebService代碼

      View Code
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Web;
      using System.Web.Services;

      /// <summary>
      /// Summary description for WebService
      /// </summary>
      [WebService(Namespace = "http://tempuri.org/")]
      [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
      // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
      [System.Web.Script.Services.ScriptService]
      public class WebService : System.Web.Services.WebService {

          public WebService () {

              //Uncomment the following line if using designed components 
              
      //InitializeComponent(); 
          }

          [WebMethod]
          public string HelloWorld( string name) {
              return "Hello World"+name;
          }
          
      }

       

      三、Jquery向ashx請求數據和向頁面相同

      Js代碼:

                  $("#Button3").bind("click", function () {
                      $.ajax({
                          type: "post",
                          url: "Handler.ashx",
                          data: "name=" + $("#Text1").val(),
                          success: function (result) {
                              alert(result.msg);
                          }
                      });
                  });

      后臺代碼:

      View Code
      <%@ WebHandler Language="C#" Class="Handler" %>

      using System;
      using System.Web;

      public class Handler : IHttpHandler {
          
          public void ProcessRequest (HttpContext context) {
              context.Response.ContentType = "text/json";
              context.Response.Write("{\"msg\":\"Hello World"+context.Request["name"]+"來自handler.ashx\"}");
              context.Response.End();
          }
       
          public bool IsReusable {
              get {
                  return false;
              }
          }

      }
      代碼下載
      posted @ 2011-12-27 21:59  Xingsoft  閱讀(29355)  評論(2)    收藏  舉報
      主站蜘蛛池模板: 国产精品不卡区一区二| 久久精品青青大伊人av| 人妻少妇456在线视频| 巨胸爆乳美女露双奶头挤奶| 日韩大片看一区二区三区| 亚洲精品熟女一区二区| 草裙社区精品视频播放| 国产涩涩视频在线观看| 一区二区三区国产不卡| 日本高清视频在线www色| 国产av综合色高清自拍| 亚洲av无码精品蜜桃| 国产成人高清亚洲综合| 成人久久精品国产亚洲av| 亚洲理论在线A中文字幕| 蛟河市| 国内精品久久久久影视| 精品午夜福利在线观看| 性一交一乱一伦| 欧美国产日韩久久mv| 久久婷婷五月综合色国产免费观看| 久久一区二区中文字幕| 天天爽夜夜爱| 麻豆精品久久久久久久99蜜桃 | 蜜臀久久精品亚洲一区| 中文字幕av一区二区| 熟妇人妻久久春色视频网| 免费夜色污私人影院在线观看 | 亚洲天堂激情av在线| 一区二区三区国产偷拍| 免费无遮挡无码永久在线观看视频| 成人午夜大片免费看爽爽爽| 最新偷拍一区二区三区| 隆化县| 久久人人97超碰精品| 成人片在线看无码不卡| 亚洲中文无码手机永久| 少妇被日自拍黄色三级网络 | 国产精品成人一区二区不卡| 性夜夜春夜夜爽夜夜免费视频| 人人人澡人人肉久久精品|