Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Naslov</title>
- <link rel="stylesheet" href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
- <style type="text/css">
- #content{
- width: 500px;
- padding: 5px;
- margin: 10px;
- display: none;
- }
- #contentList{
- list-style-type: none;
- }
- #contentList li{
- background: lightgreen;
- }
- </style>
- <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
- <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
- <script type="text/javascript">
- </script>
- </head>
- <body>
- <h3>Something like google:</h3>
- <input type="text" id="searchBox">
- <button type="button" id="searchButton">Search</button>
- <div id="content">
- <ul id="contentList">
- </ul>
- </div>
- <script type="text/javascript">
- $("#contentList li").selectable();
- $("#searchButton").click(function(){
- var term = $("#searchBox").val();
- $("#content").show();
- $.ajax({
- url: "http://www.flickr.com/services/feeds/photos_public.gne?tags=" + term + "&format=json#",
- dataType: "jsonp",
- jsonp: "jsoncallback",
- success:function(data){
- $("#contentList").html("");
- var item = data.items;
- $.each(item, function(index, object) {
- $("#contentList").append("<li style='border: solid 1px black; margin-bottom: 20px' title1='" + object.title + "'> <a style='display:block' href='" + object.link + "'>" + object.title + " </br> <img src='" + object.media.m + "'> </br>" + object.published + "</br> </li>");
- });
- }
- });
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment