I don't exactly understand what you are trying to do (what are you 
switching on? must you do this in JavaScript?)

But in order to load server content you can use either JQuery Get method
https://api.jquery.com/jquery.get/

Where you will create an empty div in your HTML, and put the server 
response in this div (with JQuery html method)

Or simply have two django views on different URLs, and then in your JS you 
will load the required page

But again I'm not sure what is your use case, why do you need to have your 
switch case in JS and not in the view ....

On Friday, December 18, 2015 at 1:54:35 AM UTC+1, Gary Roach wrote:
>
> Hi all 
>
> I am new to this and am really struggling with what should be a simple 
> problem. I have a main.html that has javascript code. There is a switch 
> statement. From the first case statement, I wish to load a template that 
> is the child of main.html. I have a /home/view.py with: 
>
> def welcome(request): 
>      return render(request, "home/welcome.html") in it. 
>
> I also have /template/home/welcome.html which is ultimately what I wish 
> to have returned. 
>
> I have jQuery loaded in main.html but have no idea how to use it. 
>
> What can I put in the javascript case statement to return welcome.html. 
>
> Welcome.html is: 
>
> <!--Web page for Welcome text--> 
> {% extends "home/main.html"  %} 
> <!--{% load staticfiles %}--> 
>
> {% block content %} 
>      <p>"yOU ARE IN WELCOME HTML"</p> 
>       <<<!--{% include "home/readMeFirst.html" %}--> 
> {% endblock %} 
>
> There is a block content statement in the body of main.html 
>
>
> Gary R. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3b83f534-625a-4d7a-85a6-441917cf187d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to