using variable in DATA of getJASON Callback function

Posted by asilloo on Stack Overflow See other posts from Stack Overflow or by asilloo
Published on 2010-06-06T20:39:23Z Indexed on 2010/06/06 20:42 UTC
Read the original article Hit count: 220

Filed under:
|

Hi,

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> 

© Stack Overflow or respective owner

Related posts about getjson

Related posts about flicker