estiens/world_cup_json — pull request #30 by smaxtastic (2014-06-23 01:53:51+00:00)
Title: JSONP support

This adds support for JSONP style callback output to use your awesome API in client-side-only web apps (usually the same-origin policy would make it impossible to use external domain JSON data–JSONP comes to the rescue).

Since you are using Rabl to output JSON I checked their [documentation](https://github.com/nesquena/rabl#configuration) and found the flag `config.enable_json_callbacks` which is exactly what I was looking for. I put a corresponding initializer in your rails project.

Now, when you call `/matches/complete?callback=foo` you get the following output:

```
foo(
[
{
"match_number": 1,
"location": "Arena Corinthians"
...
)
```

Also, for `teams` and `teams/results` I added the `callback` option to the render method.