婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > 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 表單提交示例的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 岳西县| 无锡市| 邵阳县| 牡丹江市| 乐亭县| 万宁市| 达州市| 南华县| 神池县| 阜城县| 邢台市| 马龙县| 武义县| 大方县| 晴隆县| 德清县| 仁寿县| 新巴尔虎右旗| 平远县| 苏尼特左旗| 古交市| 汶上县| 聂拉木县| 罗江县| 新巴尔虎左旗| 辉南县| 九龙城区| 三都| 玛多县| 民勤县| 娄底市| 韩城市| 政和县| 东台市| 项城市| 周宁县| 富川| 夏邑县| 禄丰县| 武陟县| 青冈县|