您的位置: 新闻频道 AJAX新闻

原创新闻 Python AJAX Server

2008-03-10 by 资深记者 jejwe
评论(3) 有1074人浏览

  前面有人发布过关于Aptana出的jaxer的信息。jaxer号称世界第一个真正的ajax服务器.现在又有人开发了一个Pyxer,是一个基于python的ajax服务器

  主页: http://www.pyxer.net/

  讨论: http://groups.google.de/group/pyxer

  下载:  http://pypi.python.org/pypi/Pyxer

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Proxy Demo</title>
</head>
<body>

    <form action="" onSubmit="save_data(document.getElementById('num').value); return false;">
        Value between 5 an 50
        <input type="text" value="" id="num" onChange="validate(this.value)">
    </form>

    <script language="Python" type="text/python" runat="both">
    def validate(value):
        value = int(value)
        if not (5 <= value <= 50):
            alert("Number not in range!")
            return False
        return True
    </script>

    <script language="Python" type="text/python" runat="server-proxy">
    def save_data(value):
            file("counter.txt", "w").write(value)

    def load_data():
            return file("counter.txt", "r").read()
    </script>

    <script language="Python" type="text/python" runat="client">
    def onload():
            document.getElementById('num').value = load_data()

    window.onload = onload
    </script>

</body>
</html>

 

评论 共 3 条 发表评论

galaxystar 2008-03-11 20:06
python的效率,还是让人比较满意的!
笨笨狗 2008-03-11 12:10
汗啊,一个jaxer冒出来,然后就有了pyxer,过几天估计ruby版的也会出来吧,呵呵

不过jaxer的服务器端ajax挺有意思,用来做信息整合不错
fengzl 2008-03-11 08:23
怎么感觉像asp

发表评论

您还没有登录,请登录后发表评论