开发者

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 java开发者_如何学编程script 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


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜