bloc referral

If you are interested in learning to code with a mentor, try bloc and get $100 off.

Friday, August 15, 2014

My tour through more Javascript components

I have spent a lot of focus on Ruby during my journey, but as of late I have been bootstrapping my learning with Javascript. The following is not pure Javascript but some of the components associated with it.

Last week I was tasked with adding a modal to the display ruby functionality, something I do not have much experience with. I have previously worked with Ajax and jQuery by including snippets in my app, but never to the scale I had to this week. It took me half a day just to get the Ajax working, all of the resources on the web push you towards a simple implementation with Coffeescript examples, but that was unfortunately not helpful. I needed to learn how to implement a solution using javascript and without js.erb files.

The article that helps me most was this blogpost. It helped me understand that Ajax works very similar REST, which I got a lot of experience with while working with the Twitter API. The similarity is because the Ajax sends/receives request via JSON. Once I realized it was JSON, I knew I just needed to parse the JSON using jQuery. I spent a lot of time learning jQuery last week and how it handles events.

Think of REST and JSON as a hash or dictionary of information that can be parsed. They seem complicated but they are not.

My apologies for not giving much context but the message was sent using the this one line in my controller and received by the following jQuery function.


I highly recommend taking the time to learn Javascript, as it is intertwined a lot of the web. I sent out a tweet this week with a whole list of free Javascript books on the web. I am looking forward to learning more in the future and hopefully sharing in more detail about JSON, Ajax, and jQuery.

No comments:

Post a Comment