KritNC
All Star
Have you heard of people using AJAX with rails apps?You might wonder what is the purpose of frameworks like Angular, Ember or even libraries like React? The are all used to aid in the creation of single page applications (SPAs) in which your refreshes are minimized. In the old days before AJAX, every time you clicked on a link, you'd send a request to a server with some information and the WHOLE page would have to reload. With AJAX and javascript, you are able to get dynamic updates. Think about when you go visit a shopping cart page and you see a cart section on the page update dynamically without you having to refresh. SPAs allow for only a certain portion of the page to be rerendered as opposed to the whole page.
What is AJAX? It stands for asynchronous javascript and XML. The purpose of AJAX is to be able to send requests to the server and get pieces of information back after the initial page load, and then javascript is used to dynamically update the page with that new information. The XML portion stands for extensible markup language, and was originally the data format that was returned from the server. Now, JSON, which is Javascript Object Notation, is the format that is typically used to return data form the server. It is much easier to parse and deal with than XML.
So in essence, a page loads. You interact with a page in some form or fashion, and behind the scenes, some of your actions cause a type of request to be sent to the server. The server analyzes your request, and then it returns data typically in JSON format. The data is then inserted into the page dynamically without you having to refresh. This is what a lot of those huge frameworks such as Angular or Ember make easier.
I am building an app now that pulls your location from your ip address then enters that into an API that returns the local weather in your area. After we have the weather information for your area we recommend a drink from our database depending on the temperature outside. They next step is we gather the weather info and see if on this day in your area it would be better to do an outside activity or inside activity. Then based on that information and your location which we pulled earlier it gathers events in your area that would be suited to the current weather conditions in your area.
The app does not have a very clear goal (based on weather we pick a drink and activity for you to do while you drink it) but it has been fun to build and I have learned alot in the process.
I am really working on writing good clean code now and have been going back over all of my code to try to tighten it up as much as possible. I might post the link to the app once I get it stylized a little more. I would love some feedback and maybe if you have any ideas I could try to implement into the app as well.