Skip to content

Commit

Permalink
add usage.md
Browse files Browse the repository at this point in the history
  • Loading branch information
geraldb committed Sep 2, 2013
1 parent b95d943 commit 9626777
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions lib/sportdb/service/views/_usage.md
@@ -0,0 +1,32 @@
%%%%%%%%%%%%%%%%%
% NB: after generation add/patch w/ macro
%
% replace
% http://footballdb.herokuapp.com/api/v1/event/en.2012_13/round/2
% with
% <%= url( '/' ) %>event/en.2012_13/round/2.... twice
%%%%%%%%%

## Usage

In your hypertext (HTML) document using a plain vanilla cross-domain JavaScript
request (using the JSONP technique):

<script>
function handleGames( json ) {
// Do something with the returned data
}
</script>

<script src="http://footballdb.herokuapp.com/api/event/en.2012_13/round/2?callback=handleGames"></script>


Or using the jQuery library using the [`getJSON` function](http://api.jquery.com/jQuery.getJSON):

$.getJSON('http://footballdb.herokuapp.com/api/event/en.2012_13/round/2?callback=?', function(json) {
// Do something with the returned data
});

Note: Add the `callback=?` query parameter to tell jQuery to use a cross-domain JSONP request.

That's it.

0 comments on commit 9626777

Please sign in to comment.