我通過使用這個幫助教程來使用web.py框架。
但我不明白是什麼做這些$登錄tutorial.html意味着
這些變量與$跡象顯示,因爲它是當我嘗試瀏覽tutorial.html即
通過本地主機
$ DEF與(格式文本) $:form.render() $文本
下面是從tutorial.html HTML
$def with (form, text)
<!doctype html>
<html>
<head>
<title>Python and AJAX tutorial for beginners with webpy and jQuery</title>
<link rel="stylesheet" type="text/css" href="/static/tutorial.css" />
<script type="text/javascript" src="/static/jquery.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(".button").click(function() {
var input_string = $$("input#textfield").val();
jQuery.ajax({
type: "POST",
data: {textfield : input_string},
success: function(data) {
jQuery('#foo').html(data).hide().fadeIn(1500);
},
});
return false;
});
});
</script>
</head>
<body>
<br>
<form class="form" method="post">
$:form.render()
<input class="button" type="submit" value="send"/>
</form>
<br><br>
<span id="foo">$text</span>
</body>
</html>
當我已經按下「發送」按鈕,然後下面的錯誤信息已經顯示了:
「錯誤響應
錯誤代碼501
消息:只能發佈到CGI腳本。
錯誤代碼的解釋:501 =服務器不支持此操作」
有沒有誰在使用web.py人?或者誰瞭解這個問題?
聽起來像你的點擊事件沒有被綁定,或者你沒有在你的ajax請求中設置正確的目標url(目前沒有目標url) –