首页
Python中文网
在线手册
Python入门
Linux教程
Python高级教程
登录
注册
用户名
Email
自动登录
找回密码
密码
登录
立即注册
扫一扫,访问微社区
只需一步,快速开始
论坛
BBS
Python教程
在线手册
Python入门
Linux教程
Python高级教程
Python函数详解
搜索
本版
帖子
用户
道具
勋章
任务
设置
退出
Python论坛 - 国内最好的Python中文社区
»
论坛
›
技术交流
›
python问答 - 求助悬赏区 Help!
›
django的查询页面问题
返回列表
查看:
1570
|
回复:
0
[求助]
django的查询页面问题
woailp___2005
当前离线
积分
4
2
主题
4
帖子
4
积分
贫民
贫民, 积分 4, 距离下一级还需 56 积分
贫民, 积分 4, 距离下一级还需 56 积分
积分
4
发消息
woailp___2005
发表于 2019-3-16 11:08:30
|
显示全部楼层
|
阅读模式
我的view.py的代码是这样的
def findinfo(request):
return render(request,'findinfo.html')
def findresult(request):
items = []
testline = {}
for i in range(10):
testline['name'] = "nxy"
testline['id'] = "123456"
items.append(testline.copy())
return render(request,'findinfo.html',{'items':items})
findinfo.html模板是这样的
<!DOCTYPE html>
<html>
<head>
<title>查询页面</title>
</head>
<body>
<form align="center" action="/findresult/" method="get">
查询条件: <input type="text" id="name" name="name"> <br><br>
<button type="button" id='find'>查询</button>
</br></br>
</form>
<table class="gridtable" align="center" id="pstable" border="1">
<thead>
<tr>
<th>姓名</th>
<th>编号</th>
</tr>
</thead>
<tbody>
{%for item in items%}
<tr>
<td>{{item.name}}</td>
<td>{{item.id}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</body>
</html>
<script src="http://apps.bdimg.com/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#find").click(function(){
$.get("/findresult/",{'name':name},
function(ret){
$('#pstable').html(ret)
})
});
});
</script>
打开页面开始显示:
点击查询后显示是这个样子的:
table里又嵌套了查询按钮,这个怎么解决啊
回复
使用道具
举报
返回列表
高级模式
B
Color
Image
Link
Quote
Code
Smilies
您需要登录后才可以回帖
登录
|
立即注册
本版积分规则
发表回复
回帖后跳转到最后一页
快速回复
返回顶部
返回列表