Created
August 16, 2015 04:15
-
-
Save levlaz/b9ec99547fa3f981f97c to your computer and use it in GitHub Desktop.
Simple JS API using JQuery
This file contains 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
<html> | |
<head> | |
<title></title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> | |
</head> | |
<body> | |
<script src="api.js"></script> | |
</body> | |
</html> |
This file contains 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
photos = $.getJSON('http://wb.bitmonkeys.io/api/get_photos/1', function(data) { | |
console.log(data); //"Object { Json content }" | |
var jsonString = JSON.stringify(data); //"{ Json content }", the "Object" literal is removed. | |
var parsed = JSON.parse(jsonString); //Parse should work now. | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment