校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 知識庫 > html+ashx 表單提交示例

html+ashx 表單提交示例

熱門標簽:浦發電話機器人提醒還款 征途美甲店地圖標注 柳州電銷機器人公司 昆明語音電銷機器人價格 電銷語音機器人型號參數 太原400電話上門辦理 騰訊地圖標注手機 百度地圖怎樣做地圖標注 400電話如何申請取消
1,sumbit表單提交

WebForm1.aspx源碼:
復制代碼 代碼如下:

%@ 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源碼:
復制代碼 代碼如下:

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="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源碼:
復制代碼 代碼如下:

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;
}
}


}
}

標簽:天門 蘭州 張家界 白山 新疆 陽泉 德陽 江蘇

巨人網絡通訊聲明:本文標題《html+ashx 表單提交示例》,本文關鍵詞  html+ashx,表單,提交,示例,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《html+ashx 表單提交示例》相關的同類信息!
  • 本頁收集關于html+ashx 表單提交示例的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 兰西县| 中宁县| 宜都市| 武夷山市| 崇明县| 静海县| 永丰县| 小金县| 东台市| 宝坻区| 维西| 枣阳市| 同仁县| 连南| 罗甸县| 昌图县| 凌云县| 内黄县| 峡江县| 长白| 平凉市| 阜城县| 汾阳市| 铜鼓县| 芜湖县| 崇州市| 白银市| 浮山县| 鸡东县| 睢宁县| 乃东县| 浦东新区| 耿马| 东乡县| 右玉县| 东至县| 邓州市| 广宁县| 崇文区| 鄂尔多斯市| 盈江县|