framer.module.ajax is an Ajax module for Framer.
Add ajax.coffee to the /modules folder of your project.
To include the module within your project, add the following:
ajax = require "ajax"framer.module.ajax consists of the method get and requires the parameters url, callback.
ajax.get(url, (response) -> callback(response))The url and callback parameters defines the URL to request and the function to run (together with response object) on success.
framer.module.ajax parses all responses as JSON.
# Module
ajax = require "ajax"
# GET
ajax.get("https://randomuser.me/api/", (response) -> createAvatar(response))
# Avatar
createAvatar = (data) ->
avatar = new Layer(
height: 200
width: 200
image: data.results[0].user.picture.large
)