午夜国产狂喷潮在线观看|国产AⅤ精品一区二区久久|中文字幕AV中文字幕|国产看片高清在线

    html+ashx 表單提交示例
    來源:易賢網(wǎng) 閱讀:1792 次 日期:2014-08-28 14:28:06
    溫馨提示:易賢網(wǎng)小編為您整理了“html+ashx 表單提交示例”,方便廣大網(wǎng)友查閱!

    這篇文章主要介紹了html+ashx 表單提交的具體實現(xiàn),需要的朋友可以參考下

    1,sumbit表單提交

    WebForm1.aspx源碼:

    代碼如下:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="NETFormDemo.ashx.WebForm1" %>

    <!DOCTYPE html>

    <html xmlns="

    <head >

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    <title></title>

    <script type="text/javascript">

    </script>

    </head>

    <body>

    <form id="form1" action="submitForm.ashx" >

    <div>

    <input type="submit" value="提交" />

    </div>

    </form>

    </body>

    </html>

    submitForm.ashx源碼:

    代碼如下:

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Web;

    namespace NETFormDemo.ashx

    {

    /// <summary>

    /// submitForm 的摘要說明

    /// </summary>

    public class submitForm : IHttpHandler

    {

    public void ProcessRequest(HttpContext context)

    {

    context.Response.ContentType = "text/plain";

    context.Response.Write("Hello World");

    }

    public bool IsReusable

    {

    get

    {

    return false;

    }

    }

    }

    }

    2,ajax提交

    HtmlPage1.html 源碼:

    代碼如下:

    <!DOCTYPE html>

    <html xmlns="

    <head>

    <title></title>

    <script src="test1.js" type="text/javascript"></script>

    <script src="jquery-1.4.min.js" type="text/javascript"></script>

    <script type="text/javascript">

    function add(url) {

    var A = $("#a1").val();

    var B = $("#b1").val();

    $.ajax({

    url: "ashx/add.ashx?i=" + A + "&j=" + B,

    data: {

    num1: A,

    num2: B

    },

    dataType: "html",

    success: function (result) {

    }

    });

    }

    </script>

    </head>

    <body>

    <form id="form1" runat="server">

    <input type="text" id="a1" />

    <input type="text" id="b1"/>

    <input type="button" onclick="add()"/>

    <label id="lb"></label>

    </form>

    </body>

    </html>

    add.ashx源碼:

    代碼如下:

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Web;

    namespace NETFormDemo.ashx

    {

    /// <summary>

    /// Login 的摘要說明

    /// </summary>

    public class Login : IHttpHandler

    {

    public void ProcessRequest(HttpContext context)

    {

    context.Response.ContentType = "text/plain";

    int first = Convert.ToInt32(context.Request.Params["i"]);

    int sec = Convert.ToInt32(context.Request.Params["j"]);

    int res = first + sec;

    context.Response.Write(res);

    context.Response.Write("fdd ff");

    }

    public bool IsReusable

    {

    get

    {

    return false;

    }

    }

    }

    }

    更多信息請查看IT技術(shù)專欄

    更多信息請查看網(wǎng)絡(luò)編程
    易賢網(wǎng)手機網(wǎng)站地址:html+ashx 表單提交示例

    2025國考·省考課程試聽報名

    • 報班類型
    • 姓名
    • 手機號
    • 驗證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
    工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號:hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)