Hi, everyone.

I'm learing Django now. Currently, I have a problem with Django and
jQuery. The detail is that:

Firstly, I have a form in the forms.py:

class TestForm(forms.Form):
    name = forms.CharField( max_length=30 )

Then, in the views.py:

def Test_page(request):
    form = TestForm()
    result= ''
    if request.GET.has_key('name'):
        query = request.GET['name'].strip()
        if query:
            form = TestForm({'name': query})
            result= 'aaaa'
    variables = RequestContext(request, {
        'form': form,
        'result': result
         })
    return render_to_response('Test.html', variables)

I'd like to use the 'result' parameter in the jQuery script in the
Test.html, when the user inputs some characters in the name field and
click the sumbit button.

The problem is that, when I use  var y = "{{result}}" by jQuery
function, the real value in the y is NOT 'aaaa' which I defined in the
views.py. By contrast, The real value for y is {{result}}.

However, if I only use the original javascript script in the Test.html
by var x ="{{result}}", the real vaule in the x is 'aaaa'.

Do you know how to use the 'result' parameter in the jQuery function?

thank you very much!
--~--~---------~--~----~------------~-------~--~----~
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