Last active
          August 6, 2020 15:28 
        
      - 
      
- 
        Save codingjester/5073097 to your computer and use it in GitHub Desktop. 
    User JQuery with the Tumblr API & JSONP
  
        
  
    
      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
    
  
  
    
  | $.ajax( | |
| 'http://api.tumblr.com/v2/blog/codingjester.tumblr.com/posts?api_key=<your_key>', | |
| { | |
| dataType: 'jsonp', | |
| success: function (d) { | |
| console.log(d); // On success log the data to the console | |
| }, | |
| } | |
| ); | |
| // More explicit information | |
| $.ajax('https://api.tumblr.com/v2/blog/codingjester.tumblr.com/posts', | |
| { | |
| dataType:'jsonp', | |
| data: { | |
| limit : 1, | |
| api_key : 'your_key' | |
| }, | |
| success: function(d) { | |
| console.log(d); | |
| } | |
| } | |
| ); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Thank you! This is my adaption: Why is this not working? I want to randomly call one tag (or even better a tagged photo on tumblr) and give an offset:
$.ajax(
api_key: "",
{
dataType: 'jsonp',
success: function (data) {
console.log(data); // On success log the data to the console
},
limit: 1,
offset: Math.round(Math.random() * moods[mood].total)
}
);