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

主頁 > 知識庫 > 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 表單提交示例的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 吴堡县| 巴中市| 衡阳县| 连城县| 县级市| 农安县| 甘谷县| 鹿邑县| 修文县| 兴化市| 衢州市| 深州市| 东光县| 旺苍县| 大关县| 固阳县| 乾安县| 邯郸市| 承德县| 衡东县| 射阳县| 佳木斯市| 古浪县| 鲜城| 邹城市| 从江县| 敖汉旗| 格尔木市| 堆龙德庆县| 霍山县| 平泉县| 吕梁市| 龙南县| 民权县| 玛纳斯县| 彭阳县| 许昌县| 新竹县| 旌德县| 娄底市| 石家庄市|