Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 840459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:37:34+00:00 2026-05-15T05:37:34+00:00

My problem is manage the code which get the tag and use is as

  • 0

My problem is manage the code which get the tag and use is as variable (var searchterm= ??????). With JSON I want first get the “location” tags with tagthe and show the relate photos from flickr.

<!DOCTYPE html>
<html>
<head>
  <style>img{ height: 100px; float: left; }</style>
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
 <div id="images">

</div>
<script>
$.getJSON("http://tagthe.net/api/?url=http://www.knallgrau.at/en&view=json&callback=MyFunc",function(data){         
              var searchterm=data[location];
        });


$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags="+searchterm+"&tagmode=any&format=json&jsoncallback=?",
        function(data){
          $.each(data.items, function(i,item){
            $("<img/>").attr("src", item.media.m).appendTo("#images");
            if ( i == 3 ) return false;
          });
        });</script>
</body>
</html> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T05:37:35+00:00Added an answer on May 15, 2026 at 5:37 am

    The second $.getJson() request is running before the first is complete, and the variable you created in the first is out of scope of the second anyway.

    Place the second $.getJson() request inside the callback for the first so that it doesn’t run until the first is complete.

    $.getJSON("http://tagthe.net/api/?url=http://www.knallgrau.at/en&view=json&callback=MyFunc",function(data){         
        var searchterm=data[location];
    
        $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags="+searchterm+"&tagmode=any&format=json&jsoncallback=?",
            function(data){
              $.each(data.items, function(i,item){
                $("<img/>").attr("src", item.media.m).appendTo("#images");
                if ( i == 3 ) return false;
              });
            });
    });
    

    EDIT:

    Here’s a version that uses $.ajax() for the first call. I specified jsonp directly, and got rid of the callback in the URL.

    Check out the live example: http://jsfiddle.net/uGJYr/2/ (updated)

    $.ajax({
        url:"http://tagthe.net/api/?url=http://www.knallgrau.at/en&view=json",
        dataType:'jsonp',
        success:function(data){
    
                // You needed to dig deeper to get the location
             var searchterm=data.memes[0].dimensions.location[0];
    
             $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags="+searchterm+"&tagmode=any&format=json&jsoncallback=?",
              function(data){
                  $.each(data.items, function(i,item){
                      $("<img/>").attr("src", item.media.m).appendTo("#images");
                      if ( i == 3 ) return false;
                  });
              });
        }
    });
    

    EDIT:

    I changed the var searchterm = line above, as the data object returned is much more complex that suggested in your original code.

    You needed:

    var searchterm=data.memes[0].dimensions.location[0];
    

    …because the data returned from the 1st request looks like this:

    {"memes":[
                {   "source":"http://www.knallgrau.at/en",
                    "updated":"Tue Jun 08 19:29:51 CEST 2010",
                    "dimensions":{  "topic":["content","knallgrau","overview","agency","nullItem","Deutsch","foundation","Company","management","English"],
                                    "content-type":["text/html"],
                                    "author":["vi knallgrau"],
                                    "person":["dieter rappold","Dieter Rappold"],
                                    "title":["Company - vi knallgrau"],
                                    "location":["Austria","Vienna"],
                                    "language":["english"],
                                    "size":["5494"]
                                }
                }
            ]
    }​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have refactored working code to use proper objects and now I can't get
A strange problem occured when i build my code on iOS5 which was properly
I don't manage to get this piece of code working. I need to get
I have new problem. My code: .method public static void Main() cil managed {
I'm using django with app-engine-patch and I'm having this wierd problem running manage.py dumpdata
The problem is that I manage scrollView with lots of tiles in it. Each
I'm having some problem with MKMapView / annotations / UINavigationController. Basically, i manage my
Having a really aggravating problem using Managed Metadata in SP2010 where I can get
I'm dealing with a problem in a kernel module that get data from userspace
Been running into a problem ever since I started using rvm to manage my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.