2016-05-17 4 views
0

問題:アマデウス空港オートコンプリート

https://sandbox.amadeus.com/travel-innovation-sandbox/apis/get/airports/autocomplete

最小例:

がここで見つけることができアマデウス空港オートコンプリートで動作するようにオートコンプリート機能を取得しよう

<!DOCTYPE html> 
<html lang="en"> 

<head> 
    <meta charset="utf-8"> 
    <title>jQuery UI Autocomplete</title> 
    <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> 
    <script src="//code.jquery.com/jquery-1.10.2.js"></script> 
    <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script> 
    <style> 
    #city { 
     width: 25em; 
    } 
    </style> 
    <script> 
    $(function() { 
     function log(message) { 
     $("<div>").text(message).prependTo("#log"); 
     $("#log").scrollTop(0); 
     } 
     $("#city").autocomplete({ 
     source: function(request, response) { 
      $.ajax({ 
      url: "http://api.sandbox.amadeus.com/v1.2/airports/autocomplete", 
      dataType: "json", 
      data: { 
       apikey: "SECRET", 
       term: request.term 
      }, 
      success: function(data) { 
       response(data); 
      } 
      }); 
     }, 
     minLength: 3, 
     select: function(event, ui) { 
      log(ui.item ? 
      "Selected: " + ui.item.label : 
      "Nothing selected, input was " + this.value); 
     }, 
     open: function() { 
      $(this).removeClass("ui-corner-all").addClass("ui-corner-top"); 
     }, 
     close: function() { 
      $(this).removeClass("ui-corner-top").addClass("ui-corner-all"); 
     } 
     }); 
    }); 
    </script> 
</head> 

<body> 
    <div class="ui-widget"> 
    <label for="city">Your city: </label> 
    <input id="city"> 
    </div> 
    <div class="ui-widget" style="margin-top:2em; font-family:Arial"> 
    Result: 
    <div id="log" style="height: 200px; width: 300px; overflow: auto;" class="ui-widget-content"></div> 
    </div> 
</body> 

</html> 

希望出力:

入力時にリスト内の空港のリストを取得する。誰かが私が逃したことを指摘できるならば感謝します。

答えて

1

答えは簡単でした。 Safari 9.0は「安全でないコンテンツ」をブロックしているようだが、私がしなければならなかったことは、動作させるためにhttp://からhttps://に変更することだけだった。

関連する問題