0
안녕하세요 세계에서 일하는 하루 종일을 보낸 후 Dajax에서 간단한 안녕하세요 세계 응답을받을 수 없습니다. 내가 MyApp를 내부 ajax.py 만든Dajax Hello World
PROJ/응용 프로그램/MyApp를 : 응용 예 폴더 내가 가진
(난 당신이 헬로우 월드 가이드에서 단어에 대한 단어는 것을 깨닫게 거라고 확신) :이 작동하지 않습니다
{% load dajaxice_templatetags %}
<html>
<head>
<title>My base template</title>
...
{% dajaxice_js_import %}
</head>
<script type="text/javascript">
function my_js_callback(data){
alert(data.message);
}
</script>
<input type="button" onclick="Dajaxice.myapp.sayhello(my_js_callback);" value="test">
</html>
:
from django.utils import simplejson
from dajaxice.decorators import dajaxice_register
@dajaxice_register
def sayhello(request):
return simplejson.dumps({'message':'Hello World'})
내 템플릿을 가지고있다. 나는 또한 발견 된 단어에 대한 설치 가이드 단어를 따라 갔다 : http://django-dajaxice.readthedocs.org/en/latest/installation.html
어떤 도움을 주시면 대단히 감사하겠습니다. 나는 내 마음을 잃어 가고있는 것처럼 느껴진다.
dajax 정적 파일을 올바르게 제공하고 있습니까? 나는'dajaxice_js_import'가 정적 URL이 올바르게 구성되어 있는지 자동으로 확인하지만 수동으로 확인하는 것은 어렵지 않을 것이라고 생각합니다. 웹 콘솔에서 dajaxice가 올바르게로드되었는지 확인하십시오. –
@RomanAlexander 그래, 난 파일을 제공하는 URL에 설치하고 runserver에서 정적 파일을 적절하게 당기는 볼 수 있습니다. – moreisee
나는 바보 야. 나는 닫는 대괄호를 잊었다. 그것을 조사해 주셔서 감사합니다 @RomanAlexander. – moreisee