ramdaz
ramdaz

Reputation: 1791

how to use a jquery post inside a django submit form

I have a view which is something like this

def post_details(request,id):  
    if request.method== POST:  
        form=SubmitForm(request.POST)  
        if form.is_valid():

Now one of the things the form is supposed to do is register a user automatically, and then send the details to another page. I have on click of submit button a javascript whcih essentially does do registering part. The code is given below. But after registering the user does not come back to the form, and complete rest of the job at hand, such as redirect also with data to another page. What should I do? It registers, and then stays on the page.

Jquery code is here in the pastebin

http://pastebin.com/GPu4Ss4F

Thanks

Upvotes: 2

Views: 189

Answers (1)

rolling stone
rolling stone

Reputation: 13016

The advantage of jQuery is that you don't need to refresh or re-direct users to a new page. Since you're already doing that it kind of defeats the purpose of jQuery, so why not just handle the user registration and any other functions in the view?

Upvotes: 1

Related Questions