Hi all,
I have the problem for constructing waiting page using Django + ajax.
I followed instructions mentioned in the following link,
http://groups.google.com/group/django-users/browse_thread/thread/c1b0d916bbf86868.
However, when I run my program, it stops in  http://127.0.0.1:8000/please_wait
and will not redirect to the result page like "http://127.0.0.1:8000/
display_DHM"

does anybody know what is going on?
I basically use the following instructions.

>>> >>> > # please_wait.html
>>> >>> > ...
>>> >>> > <script type="text/javascript"
>>> >>> > src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js";></script>
>>> >>> > <script type="text/javascript">
>>> >>> >     $.get('{% url run_DHM %}', function(data) {
>>> >>> >         if (data == 'OK') {
>>> >>> >               window.location.href = '{% url display_DHM %}';
>>> >>> >         } else {
>>> >>> >               alert(data);
>>> >>> >         }
>>> >>> >     });
>>> >>> > </script>
>>> >>> > Note I've used the shorthand urls above, you could just use
>>> >>> > '/run_DHM/'
>>> >>> > and
>>> >>> > '/display_DHM/' instead of the url template tags. You could also use
>>> >>> > the
>>> >>> > full package path. Also note that the callback function I refer to
>>> >>> > is
>>> >>> > defined inline - the function(data) ... part.
>>> >>> > # views.py
>>> >>> > from django.http import HttpResponse
>>> >>> > def please_wait(request):
>>> >>> >     return render_to_response('please_wait.html', ...)
>>> >>> > def run_DHM(request):
>>> >>> >     # Do calculations, store results in request.session
>>> >>> >     ...
>>> >>> >     # If everything ok, return OK (otherwise return some error)
>>> >>> >     return HttpResponse('OK')
>>> >>> > def display_DHM(request):
>>> >>> >     # Get results from session
>>> >>> >     return render_to_response('ran_DHM.html', ...)


Thanks,
trace

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to