<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當(dāng)前位置: 首頁 - 科技 - 知識百科 - 正文

        Jquery異步請求數(shù)據(jù)實例代碼_jquery

        來源:懂視網(wǎng) 責(zé)編:小采 時間:2020-11-27 21:01:52
        文檔

        Jquery異步請求數(shù)據(jù)實例代碼_jquery

        Jquery異步請求數(shù)據(jù)實例代碼_jquery:一、Jquery向aspx頁面請求數(shù)據(jù) 前臺頁面JS代碼: 代碼如下: $(#Button1).bind(click, function () { $.ajax({ type: post, url: default.aspx, data: name= + $(#Text1).val(), success: fun
        推薦度:
        導(dǎo)讀Jquery異步請求數(shù)據(jù)實例代碼_jquery:一、Jquery向aspx頁面請求數(shù)據(jù) 前臺頁面JS代碼: 代碼如下: $(#Button1).bind(click, function () { $.ajax({ type: post, url: default.aspx, data: name= + $(#Text1).val(), success: fun

        一、Jquery向aspx頁面請求數(shù)據(jù)
        前臺頁面JS代碼:
        代碼如下:
        $("#Button1").bind("click", function () {
        $.ajax({
        type: "post",
        url: "default.aspx",
        data: "name=" + $("#Text1").val(),
        success: function (result) {
        alert(result.msg);
        }
        });
        });

        代碼如下:



        后臺cs代碼:
        代碼如下:
        protected void Page_Load(object sender, EventArgs e)
        {
        if (Request["name"]!=null)
        {
        Response.ContentType = "text/json";
        Response.Write("{\"msg\":\""+Request["name"]+"\"}");//將數(shù)據(jù)拼湊為Json
        Response.End();
        }
        }

        二、Jquery向WebService頁面請求數(shù)據(jù)
        代碼如下:
        $("#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);
        }
        });
        });


        WebService代碼
        代碼如下:
        using System;
        using System.Collections.Generic;
        using System.Linq;
        using System.Web;
        using System.Web.Services;
        ///
        /// Summary description for WebService
        ///

        [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請求數(shù)據(jù)和向頁面相同
        Js代碼:
        代碼如下:
        $("#Button3").bind("click", function () {
        $.ajax({
        type: "post",
        url: "Handler.ashx",
        data: "name=" + $("#Text1").val(),
        success: function (result) {
        alert(result.msg);
        }
        });
        });

        后臺代碼:
        代碼如下:
        <%@ 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;
        }
        }
        }

        代碼下載

        聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        Jquery異步請求數(shù)據(jù)實例代碼_jquery

        Jquery異步請求數(shù)據(jù)實例代碼_jquery:一、Jquery向aspx頁面請求數(shù)據(jù) 前臺頁面JS代碼: 代碼如下: $(#Button1).bind(click, function () { $.ajax({ type: post, url: default.aspx, data: name= + $(#Text1).val(), success: fun
        推薦度:
        標(biāo)簽: 數(shù)據(jù) 代碼 例子
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 免费人成在线观看网站品爱网 | 大桥未久亚洲无av码在线| 麻豆成人久久精品二区三区免费| 中文字幕亚洲日韩无线码| 成年网在线观看免费观看网址| 免费va人成视频网站全| 色www免费视频| 久久亚洲国产精品五月天婷| jyzzjyzz国产免费观看| 亚洲欧洲精品无码AV| 亚洲免费在线视频| 免费a级毛片无码av| 在线播放免费人成视频网站 | 久久精品九九亚洲精品天堂| 亚洲日韩乱码中文字幕| 午夜时刻免费入口| 免费毛片毛片网址| 国产亚洲人成无码网在线观看| 日韩精品亚洲专区在线影视| 亚洲?v无码国产在丝袜线观看| 美女无遮挡拍拍拍免费视频| 4480yy私人影院亚洲| 欧美好看的免费电影在线观看| 亚洲av无码专区在线电影天堂| 亚洲成人一区二区| 日韩精品免费在线视频| 国产成人麻豆亚洲综合无码精品| 国内精品免费在线观看| 亚洲一区二区三区在线观看蜜桃| 污视频在线观看免费| 亚洲人成www在线播放| 很黄很色很刺激的视频免费| 国产精品成人亚洲| 日韩免费电影在线观看| 国产人成网在线播放VA免费| 亚洲黄色在线视频| 亚洲成A∨人片天堂网无码| 日韩精品人妻系列无码专区免费| 亚洲国产成人AV在线播放| 亚洲精品国偷自产在线| 四虎影视免费在线|