佳木斯湛栽影视文化发展公司

主頁 > 知識(shí)庫 > Ajax動(dòng)態(tài)加載數(shù)據(jù)庫示例

Ajax動(dòng)態(tài)加載數(shù)據(jù)庫示例

熱門標(biāo)簽:服務(wù)器配置 科大訊飛語音識(shí)別系統(tǒng) 阿里云 電子圍欄 銀行業(yè)務(wù) Linux服務(wù)器 Mysql連接數(shù)設(shè)置 團(tuán)購網(wǎng)站
復(fù)制代碼 代碼如下:

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

html xmlns="http://www.w3.org/1999/xhtml">
head>
title>/title>
script type ="text/javascript">
function btnClick() {
var xmlhttp = xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
if (!xmlhttp) {
alert("創(chuàng)建xmlhttp對(duì)象異常!");
return false;
}
var text1 = document.getElementById("Text1");
xmlhttp.open("post","GetPrice2.ashx?ts"+text1, false);
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
document.getElementById("Text2").value = xmlhttp.responseText;
}
else {
alert("Ajax返回錯(cuò)誤!");
}
}
}
xmlhttp.send();
}
/script>
/head>
body>

p>
產(chǎn)品名稱:input id="Text1" type="text" />/p>
p>
價(jià)格:input id="Text2" type="text" />/p>
p>
input id="Button1" type="button" value="查詢" onclick = "btnClick()"/>/p>
/body>
/html>

復(fù)制代碼 代碼如下:

%@ WebHandler Language="C#" Class="GetPrice" %>

using System;
using System.Linq;
using System.Web;
using DataSetProductsTableAdapters;

public class GetPrice : IHttpHandler {

public void ProcessRequest (HttpContext context)
{
context.Response.ContentType = "text/plain";
//context.Response.Write("Hello World");
string name = context.Request["text1"];
var data = new PriceTableAdapter().GetDataByName(name);//需要建一個(gè)強(qiáng)類型的dataset
if (data.Count = 0)
{
context.Response.Write("none|0");
}
else
{
context.Response.Write("ok|" + data.Single().Price);
}
}

public bool IsReusable {
get {
return false;
}
}

}
您可能感興趣的文章:
  • 通過Spring Boot配置動(dòng)態(tài)數(shù)據(jù)源訪問多個(gè)數(shù)據(jù)庫的實(shí)現(xiàn)代碼
  • 詳解SpringBoot 創(chuàng)建定時(shí)任務(wù)(配合數(shù)據(jù)庫動(dòng)態(tài)執(zhí)行)
  • asp.net實(shí)現(xiàn)的MVC跨數(shù)據(jù)庫多表聯(lián)合動(dòng)態(tài)條件查詢功能示例
  • Java的MyBatis框架中對(duì)數(shù)據(jù)庫進(jìn)行動(dòng)態(tài)SQL查詢的教程
  • Yii操作數(shù)據(jù)庫實(shí)現(xiàn)動(dòng)態(tài)獲取表名的方法
  • C#動(dòng)態(tài)創(chuàng)建Access數(shù)據(jù)庫及表的方法
  • ext combobox動(dòng)態(tài)加載數(shù)據(jù)庫數(shù)據(jù)(附前后臺(tái))
  • c# asp .net 動(dòng)態(tài)創(chuàng)建sql數(shù)據(jù)庫表的方法
  • javascript動(dòng)態(tài)添加表格數(shù)據(jù)行(ASP后臺(tái)數(shù)據(jù)庫保存例子)
  • Mysql動(dòng)態(tài)更新數(shù)據(jù)庫腳本的示例講解

標(biāo)簽:萍鄉(xiāng) 廣元 蚌埠 衡水 大理 棗莊 江蘇 衢州

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Ajax動(dòng)態(tài)加載數(shù)據(jù)庫示例》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    大城县| 屏边| 泉州市| 西宁市| 浦县| 阜南县| 同心县| 昌乐县| 施甸县| 滦南县| 泸溪县| 南陵县| 九寨沟县| 包头市| 金溪县| 宝丰县| 通城县| 长乐市| 婺源县| 巴马| 深州市| 乌恰县| 永靖县| 丹巴县| 巫溪县| 荣成市| 梓潼县| 崇州市| 繁昌县| 吉木乃县| 富民县| 海城市| 宜章县| 佛教| 宁阳县| 嘉峪关市| 资溪县| 旺苍县| 岳阳市| 梓潼县| 方城县|