[Answer]-Loading new page after button is clicked (not duplicate)

1👍

The first is making an ajax request, using javacript. The response is contained in javascript. The other 2 are changing the location (url) of the webpage.

Additionally: Django provides a fully contained templating engine, and template loader that wraps all the loading of templates for you. You should not have to manually open the file and read its contents and return it as a string like you are doing below:

def screen2(request):
    f = open(r'mysite/frontend/2nd Screen.html','r')
    html = f.read()
    return HttpResponse(html)

The django tutorial provides an exapmle of how to render templates using djangos built in functions

I am Assuming that you have not done any configuration to serve static files (How to send the corresponding scripts and css files with the request ?). Django provides examples of how to do this here

Leave a comment