Last active
August 29, 2015 14:23
-
-
Save meirabruno/a12db5271163a0fd4674 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Exemplo de consumo API V1 CMS GVces</title> | |
| <script src="https://code.jquery.com/jquery-1.10.2.js"></script> | |
| </head> | |
| <body> | |
| <script> | |
| (function() { | |
| var gvcesAPI = "https://cms-gvces-staging.herokuapp.com/api/v1/noticias"; | |
| $.get(gvcesAPI, function(data) { | |
| if(data.meta.type == 'list'){ | |
| data.categories.forEach(function(item){ | |
| $("<div><strong>" + item.title + "</strong><br><span>" + item.date_published_complet + "</span><br><span>" + item.resume + "</span></div><span><p>" + data.meta.pages + "</p>").appendTo( "body" ); | |
| }); | |
| }else{ | |
| $("<div><strong>" + data.post_preview.title + "</strong><br><span>" + data.post_preview.date_published_complet + "</span><br><span>" + data.post_preview.resume + "</span></div><span><br><p>" + data.post_preview.content + "</p>").appendTo( "body" ); | |
| } | |
| }); | |
| })(); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment