ajax get server side time string, pyramid example

Friday, June 10, 2011

ajax get server side time string, pyramid example

#route
config.add_route("servertime", "/servertime")

#server side
@view_config(route_name="servertime", renderer='string')
def serverTime(request):
    return datetime.now()

#client
var timeStr = $.ajax({url: "/servertime", async: false}).responseText;

This entry was tagged Pyramid and Python

comments powered by Disqus

© 2009-2013 lxneng.com. All rights reserved. Powered by Pyramid

go to Top