Hi,
Does anyone can help?
Here are all contents in my files, I tried variable ways, but when I
submit a form, it only return the please_wait page and then stay there
forever. There is no redirect happened.
Since I want to check if it works first, there is no actual
calculation in the code.


#########  url.py  ################
urlpatterns = patterns('',
        (r'^test$',views.test_form),
        (r'^please_wait', views.please_wait),
    url(r'^run_DHM$', views.run_DHM, name="run_DHM") ,
    url(r'^displayDHM', views.display_DHM, name="displayDHM")
)


########### view.py #############
def test_form(request):
        return render_to_response('test.html')

def please_wait(request):
        return render_to_response('please_wait.html')

def run_DHM(request):
       ### lengthy calculations... ...
        return HttpResponse("OK")

def display_DHM(request):
    return render_to_response('display_DHM.html')

########## test.html ###########
{% extends "baseFrame.html" %}

{% block maincontent %}
  <form method="POST" action="please_wait">
   <p>Test:</p>
   <div id="address"></div>
   <p>Type your value in here:</p>
   <p><textarea name="order" rows="6" cols="50" id="order"></
textarea></p>
   <p><input type="submit" value="submit" id="submit" /></p>
  </form>
{% endblock %}


########### please_wait.html ##########

<html>Please wait
<script type="text/javascript" src="http://code.jquery.com/
jquery-1.7.1.min.js">
$.getJSON('{% url run_DHM %}', function(data) {
        if (data == 'OK') {
                  window.location.href = '{% url displayDHM %}';
            } else {
                  alert(data);
            }
    });
</script>
</html>


###########  display_DHM.html #########
<HTML>
<BODY>END FINALLY!</BODY>
</HTML>

-- 
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