Etian
V2EX  ›  问与答

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

  •  
  •   Etian · Mar 2, 2015 · 2402 views
    This topic created in 4121 days ago, the information mentioned may be changed or developed.
    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 replies    2015-03-03 00:30:07 +08:00
    Etian
        1
    Etian  
    OP
       Mar 3, 2015
    暂时用ajax解决
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2733 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 02:08 · PVG 10:08 · LAX 19:08 · JFK 22:08
    ♥ Do have faith in what you're doing.