最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
jquery AJAX无刷新评论实例
时间:2010-08-12 编辑:简简单单 来源:一聚教程网
jquery ajax无刷新评论
css教程" href="style.css" />
<%
<%
dim action, id, page, pagehtml, pages, linkhtml
pages = 5
action = request.querystring("action")
id = request.querystring("id")
page = request.querystring("page")
select case action
case "ajax_getcomment"
ajax_getcomment()
case "ajax_sendcomment"
ajax_sendcomment()
case else
echo("erro")
end selectfunction ajax_getcomment()
dim temlist, getlist
openconn(dbpath)
sql = "select commentuser,commentdate,commenttext,commentreply from comment where commentparentid="&id&" order by commentid asc"
call openrs(sql, 1)
if not(rs.bof and rs.eof) then
rs.pagesize = pages
rscount = rs.recordcount
pagenum = rs.pagecount
page = clng(page)
if page < 1 then page = 1
if page > pagenum then page = pagenum
rs.absolutepage = page
k = 1
do while not rs.eof
temlist = ""&vbcrlf"&vbcrlf
temlist = temlist& ""&rs(0)&" 发表于 "&rs(1)&""&vbcrlf
temlist = temlist& ""&rs(2)&""&vbcrlf
if rs(3)<>"" then
temlist = temlist& "回复:"&rs(3)&""&vbcrlf
end if
temlist = temlist& "
k = k + 1
rs.movenext
getlist = getlist & temlist
if k > pages then exit do
loop
else
echo ("暂无评论内容")
end if
closers()
closeconn()
'显示分页相关信息
if rscount>0 then
pagehtml = "已有"&rscount&"条评论 {$link_list$}"
if pagenum>1 then
for i = 1 to pagenum
linkhtml = linkhtml & iif(i = page, ""& i &" ", "" & i & " ")
next
else
linkhtml = ""
end if
pagehtml = replace(pagehtml, "{$link_list$}", linkhtml)
end if
echo (getlist&pagehtml)
end functionfunction ajax_sendcomment()
dim commentparentid, commentuser, commenttext, commentvalidate
openconn(dbpath)
commentparentid = request.querystring("commentparentid")
commentuser = unescape(request.querystring("commentuser"))
commenttext = unescape(request.querystring("commenttext"))
commentvalidate = unescape(request.querystring("commentvalidate"))
if cstr(session("getcode"))<>commentvalidate then
echo ("error")
response.end()
else
sql = "insert into comment(commentparentid,commentuser,commenttext,commentreply,commentip) values('"&commentparentid&"','"&commentuser&"','"&server.htmlencode(commenttext)&"','','"&getip()&"')"
set rs = conn.execute(sql)
closers()
closeconn()
echo ("评论发表成功.")
end if
end function
%>
%>
文章无刷新评论代码,如果你想让ajax加载评与ajax发送评论话就下载吧
相关文章
- HTML简单购物数量小程序代码展示 10-31
- html canvas实现弹幕功能 10-31
- HTML中空格表示的意义 10-31
- html area标签解读 10-31
- html使用表单标签实现注册页面代码展示 10-31
- 使用HTML截图并保存为本地图片的代码展示 10-31