我是一位經驗豐富的開發人員,擁有C#,JAVA和C/C++經驗,但主要從事非Web應用程序/進程。學習資源Django + AJAX
我在過去幾個月裏爲自己的項目選擇了Python和Django。我處於爲我的web應用程序需要一些AJAX元素的階段。我只知道JavaScript的基本內容,更不用說AJAX。
請爲我推薦一些資源,以瞭解如何在Django上使用AJAX,讓它成爲書籍和/或在線資料。請注意,我的計劃是使用JQuery作爲我的JavaScript庫。謝謝。
我是一位經驗豐富的開發人員,擁有C#,JAVA和C/C++經驗,但主要從事非Web應用程序/進程。學習資源Django + AJAX
我在過去幾個月裏爲自己的項目選擇了Python和Django。我處於爲我的web應用程序需要一些AJAX元素的階段。我只知道JavaScript的基本內容,更不用說AJAX。
請爲我推薦一些資源,以瞭解如何在Django上使用AJAX,讓它成爲書籍和/或在線資料。請注意,我的計劃是使用JQuery作爲我的JavaScript庫。謝謝。
這將是一個開始jQuery tutorials的好地方。在這方面,John Resig對jQuery的工作方式有basic intro。
當我剛纔問這個問題時,我並沒有真正清楚和完整的AJAX + Django圖片。憑藉我從那時起積累的經驗,我建議新手開發人員將這兩種技術看作是相互排斥的。 – tamakisquare 2013-01-27 02:37:01
對於一個結婚AJAX(通過jQuery)和Django的絕佳例子,請查看django-dynamic-formsets。有一個lotothergood examples也有!
< 3 AJAX & Django!好玩。 Dajax試圖讓使用ajax更容易(雖然它很容易開始)。這裏有一對夫婦更多的博客文章:
而且,這裏是一個簡單的例子,你可以(在urls.py使用)玩:
import json
from django.http import HttpResponse
from django.template import Template, Context
def ajax(request):
"""returns json response"""
return HttpResponse(json.dumps({'foo': 'bar'}), mimetype='application/json')
def index(request):
"""simple index page which uses jquery to make a single get request to /ajax, alerting the value of foo"""
t = Template("""
<!doctype html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript">
$.get('/ajax/', function(data) {
alert(data['foo']);
});
</script>
</head>
</html>""")
return HttpResponse(t.render(Context()))
# urlconf
urlpatterns = patterns('',
(r'^$', index),
(r'^ajax/', ajax),
)
感謝所有的答覆。我正在經歷他們的過程,然後我會決定接受誰的答案。 :) – tamakisquare 2011-05-09 17:16:53
請選擇一個答案。 – Unapiedra 2013-01-26 14:33:06