Reputation: 48664
I have following template files in my django project:
Here both base_test1.html
and base_test2.html
extends base.html
. My home page renders base_test1.html
. In my home page, I have a button which when pressed should render base_test2.html
. How should I achieve this?
I have been trying to use jQuery ajax call so that when the button is pressed, I call the corresponding view in the views.py
of my application. But that doesn't seem to be working since the ajax call just returns the html page to the request rather than rendering it.
Upvotes: 0
Views: 1932
Reputation: 53336
If you want to use ajax, the base_test2.html
should not return complete HTML page. But just some block in the html page, which you replace in the original page.
Upvotes: 1