V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Etian
V2EX  ›  问与答

Python 中使用 Web 框架 bottle,服务端返回内容如何显示到已经写好样式的页面上

  •  
  •   Etian · 2015-03-02 22:09:41 +08:00 · 1732 次点击
    这是一个创建于 3367 天前的主题,其中的信息可能已经有所发展或是发生改变。
    get请求时返回tpl模板@get(/newtask)
    return template('newtask.tpl')
    其中newtask.tpl是已经写好样式的html页面

    post提交表单时会返回校验信息或者返回“编辑成功”类似信息
    @post(/newtask)
    if():
    return “内容不能为空”
    else:
    return “添加成功”

    如果编辑成功post提交后url为:localhost:8080/newtask此时页面是
    <html>
    <body>
    添加成功
    </body>
    </html>
    页面一点样式都没有了
    如何让这些返回值也显示在写好样式的newtask.tpl 页面上呢?
    1 条回复    2015-03-03 00:30:07 +08:00
    Etian
        1
    Etian  
    OP
       2015-03-03 00:30:07 +08:00
    暂时用ajax解决
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   4901 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 09:27 · PVG 17:27 · LAX 02:27 · JFK 05:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.