The communication between web browser(client) and web server(server) is always initiated by the client. There is no way a server can initiate the communication by itself. If your browser received a web page from a server, then a request would have been sent to the server, even if the user is unaware of it.
Browser can only understand HTML code, so any data coming from the server will be in the form of HTML, no matter how complex the logic is. Remember, how inspecting a web browser element, opens up a whole lot of HTML code, even if you know you wrote the code in some different language. So every data is converted to HTML before sending it to the browser.
Writing HTML is nothing, but writing a certain set of instructions, which tells the browser to print data exactly in the way we want.
Data between client and server is transmitted with the help of HTTP protocol. HTTP protocol is based on the request-response model. Whenever a URL is typed into the browser, an HTTP request is sent to the server where the related web application resides. This server is a physical machine. The web application in turn sends the data in the form of HTTP response.
Every message in the HTTP protocol is associated with a method. These methods tells us the intention of the client. If client sends a GET request, it means that client is requesting some data from the server. If client sends a POST request(example: submitting a form), then it means that the client is trying to submit something to the server. GET methods are usually considered safe, since it does not alter the state of the web application. POST methods is the interactive way of communicating with the website, since you get to send the data and that data can alter the state of web application, example- creation of new user when user submits sign up form. Unlike GET method, response sent for the POST request may not necessarily be a HTML response, it can be a simple status code, which user can interpret and determine if the operation was successful or not.
Where does Web Framework fit into all this?
If we take all that is mentioned above into account, there are number of problems that will arise:
- How do we determine what URL has been requested and return the appropriate response(page)?
- How do we deal with these HTTP methods?
- How do we handle more advanced concepts like sessions and cookies?
- How do we scale are application to deal with thousands of concurrent connections?
Now, we do not want to solve these problems every time we build a website. If we had to reinvent the wheel, I doubt making websites would be as easy as it is now. Web frameworks contains packages that handle these things and provide an appropriate solution for it. Now at the core, these packages work just like this example:
-Receiving requests and sending an appropriate response.
Frameworks help in hiding the boilerplate and infrastructural code related to handling the HTTP requests and responses, so that we can focus on developing the website.
References:  What is a web framework?