I am totally newbiew to REST API and from all reading, got a little bit hands on with Sinatra as it looks really simple in terms of the syntax.
However i am a little bit confused as to how a entire 3 tier set up with http web server and app server work. I am planning to learn by writing a simple web application which goes a little more than "hello world" .
My setup I have 2 html page lets say a.html and b.html. a.html is my home page and I set it in htdocs i.e using Apache.
In a.html i click on a button . Now this button click calls a http get to a particular route say a.html/files . now this route is defined inside my Sinatra ruby code in Passenger and it returns a JSON object that must be consumed by b.html and b.html is the next page that the client must see.
So I am a bit confused, if I am calling the route a.html/files and it returns a JSON , how do i route it to b.html to consume it and how does the client now see b.html?. i.e the web browser must be redirected to b.html with the JSON object parsed in its JavaScript and displayed . But how will this happen if the client had called a.html/files and there is no mention of b.html here.
This very basic point is where i am stuck :(