JQuery的ajax的用法在asp中使用$.ajax()實(shí)現(xiàn)_AJAX教程
教程Tag:暫無(wú)Tag,歡迎添加,賺取U幣!
推薦:Ajax二級(jí)聯(lián)動(dòng)菜單實(shí)現(xiàn)原理及代碼二級(jí)聯(lián)動(dòng)菜單,一個(gè)多么方便且實(shí)用的用戶交互功能,有需求的朋友可以參考下本文,或許對(duì)你的菜單知識(shí)深入學(xué)習(xí)有幫助,好了,閑話不多說(shuō),看代碼吧
復(fù)制代碼 代碼如下:hl5o.cn
<%
response.Expires=-1
response.CacheControl="no-cache"
%>
<!--#include file="../../conn/conn.asp"-->
<!--#include file="../psw.asp"-->
<!--#include file="../../functions/dofunction.asp"-->
<!--#include file="../../functions/showfunction.asp"-->
<!--#include file="../../fqdb/admin/website.asp"-->
<%
cmd = checkstr(request("cmd"),2)
if cmd="loadteacher" then
response.Charset = "gb2312"
set rs=server.CreateObject("adodb.recordset")
sql="select teacher_id,name from Edu_Person"
rs.open sql,conn,1,3
response.write "{""data"":["
i = 0
do until rs.eof
i = i + 1
response.write "{""Id"":"&rs("teacher_id")&",""Name"":"""&rs("name")&"""}"
if i<rs.recordcount then response.write ","
rs.movenext()
loop
response.write "]}"
response.End()
end if
%>
復(fù)制代碼 代碼如下:hl5o.cn
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無(wú)標(biāo)題文檔</title>
<script type="text/javascript" src="../../js/common/jquery-1.8.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#btn1").click(function(){
//alert("click");
$.ajax({
url:"ajaxtest.asp?cmd=loadteacher",
dataType:"json",
success:function(json){
//var odata = $.parseJSON(json);
var data = json.data;
for(var i = 0,len = data.length;i<len ;i++){
document.writeln(data[i].Name);
}
}
});
});
});
</script>
</head>
<body>
<form id="myform" method="post" action="ajaxtest.asp">
<!--<input type="hidden" name="cmd" value="loadteacher">-->
<select id="tearchers" name="teachers">
<option value="請(qǐng)選擇"></option>
</select>
<input type="button" id="btn1" name="btn1" value="加載老師">
<!--<input type="submit" value="提交">-->
</form>
</body>
</html>
分享:Ajax方式提交帶文件上傳的表單及隱藏iframe應(yīng)用一般的表單都是通過(guò)ajax方式提交,所以碰到帶文件上傳的表單就比較麻煩,基本原理就是在頁(yè)面增加一個(gè)隱藏iframe,然后通過(guò)ajax提交除文件之外的表單數(shù)據(jù),感興趣的你不妨了解一下,或許本文對(duì)你有所幫助
相關(guān)AJAX教程:
- Ajax中瀏覽器的緩存問題解決方法
- AJAX和WebService實(shí)現(xiàn)省市縣三級(jí)聯(lián)動(dòng)具體代碼
- ajax 登錄功能簡(jiǎn)單實(shí)現(xiàn)(未連接數(shù)據(jù)庫(kù))
- AJAX和WebService實(shí)現(xiàn)郵箱驗(yàn)證(無(wú)刷新驗(yàn)證郵件地址是否合法)
- AJAX和三層架構(gòu)實(shí)現(xiàn)分頁(yè)功能具體思路及代碼
- 使用AJAX返回WebService里的集合具體實(shí)現(xiàn)
- AJAX獲取服務(wù)器當(dāng)前時(shí)間及時(shí)間格式輸出處理
- ajax傳遞多個(gè)參數(shù)具體實(shí)現(xiàn)
- ajax傳遞一個(gè)參數(shù)具體實(shí)現(xiàn)
- 滑輪滾動(dòng)到頁(yè)面底部ajax加載數(shù)據(jù)配合jsonp實(shí)現(xiàn)探討
- jQery ajax——load()方法示例介紹
- jQuery+Ajax實(shí)現(xiàn)表格數(shù)據(jù)不同列標(biāo)題排序(為表格注入活力)
- 相關(guān)鏈接:
復(fù)制本頁(yè)鏈接| 搜索JQuery的ajax的用法在asp中使用$.ajax()實(shí)現(xiàn)
- 教程說(shuō)明:
AJAX教程-JQuery的ajax的用法在asp中使用$.ajax()實(shí)現(xiàn)
。