-
Book Overview & Buying
-
Table Of Contents
CoffeeScript Application Development
By :
For the sake of simplicity, we have so far refrained from using any third-party libraries. Now, however, we're going to pull in a library to help us make remote web requests. In the process, we'll also experience just how easy it is to integrate our CoffeeScript with a third-party library written in JavaScript. Reqwest is a small, focused library built specifically to help with AJAX requests, so it's perfect for us.
To learn more about Reqwest, visit the project page at https://github.com/ded/Reqwest.
First, download the library from https://github.com/iangreenleaf/reqwest/raw/coffeescript_book/reqwest.js. Put this file in our application's directory and name it reqwest.js. Now we'll include it at the beginning of the JavaScript files in index.html:
<script src="reqwest.js"></script>
<script src="person.js"></script>
<script src="animal.js"></script>We're ready to use Reqwest in animal.coffee. A typical reqwest call (in JavaScript...
Change the font size
Change margin width
Change background colour