濮阳杆衣贸易有限公司

主頁(yè) > 知識(shí)庫(kù) > html+ashx 表單提交示例

html+ashx 表單提交示例

熱門(mén)標(biāo)簽:浦發(fā)電話機(jī)器人提醒還款 征途美甲店地圖標(biāo)注 柳州電銷(xiāo)機(jī)器人公司 昆明語(yǔ)音電銷(xiāo)機(jī)器人價(jià)格 電銷(xiāo)語(yǔ)音機(jī)器人型號(hào)參數(shù) 太原400電話上門(mén)辦理 騰訊地圖標(biāo)注手機(jī) 百度地圖怎樣做地圖標(biāo)注 400電話如何申請(qǐng)取消
1,sumbit表單提交

WebForm1.aspx源碼:
復(fù)制代碼 代碼如下:

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

!DOCTYPE html>

html xmlns="http://www.w3.org/1999/xhtml">
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源碼:
復(fù)制代碼 代碼如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace NETFormDemo.ashx
{
/// summary>
/// submitForm 的摘要說(shuō)明
/// /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 源碼:
復(fù)制代碼 代碼如下:

!DOCTYPE html>

html xmlns="http://www.w3.org/1999/xhtml">

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源碼:
復(fù)制代碼 代碼如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace NETFormDemo.ashx
{
/// summary>
/// Login 的摘要說(shuō)明
/// /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;
}
}


}
}

標(biāo)簽:天門(mén) 蘭州 張家界 白山 新疆 陽(yáng)泉 德陽(yáng) 江蘇

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《html+ashx 表單提交示例》,本文關(guān)鍵詞  html+ashx,表單,提交,示例,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《html+ashx 表單提交示例》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于html+ashx 表單提交示例的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    阜宁县| 湾仔区| 房山区| 多伦县| 松溪县| 西乌珠穆沁旗| 舞钢市| 闽清县| 临西县| 神池县| 昭觉县| 康马县| 霍林郭勒市| 中牟县| 绥芬河市| 边坝县| 庄河市| 湖北省| 新疆| 嵩明县| 宁德市| 沙湾县| 开鲁县| 防城港市| 纳雍县| 岑溪市| 云梦县| 苍山县| 大宁县| 西青区| 虹口区| 平湖市| 天门市| 郴州市| 葫芦岛市| 铜陵市| 马关县| 分宜县| 恩平市| 盐津县| 巴彦淖尔市|