msaracevic

EVE CREST access main file

Jun 1st, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.10 KB | None | 0 0
  1. <head>
  2.     <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  3. </head>
  4.  
  5. <body>
  6.    
  7.     <button type="button" onclick="get_incursion_data();">Get data</button>
  8.     <div id="output">
  9.    
  10.        
  11.    
  12.     </div>
  13.    
  14.     <script>
  15.         function get_incursion_data() {
  16.             $.ajax({
  17.                 url: "crest_proxy.php",
  18.                 data: {request_url: "http://public-crest.eveonline.com/incursions/"},
  19.                 dataType: 'json',
  20.                 success: function(response) {
  21.                     response_string = JSON.stringify(response);
  22.                     document.getElementById("output").innerHTML = response_string;
  23.                    
  24.                     // part below overrides the line above and shows example how to move through json response from CREST
  25.                     var total_number = response.totalCount_str;
  26.                     var data_From_server = "";
  27.                    
  28.                     for (var i=0;i<total_number;i++) {
  29.                         name = response.items[i].constellation.name;
  30.                         state = response.items[i].state;
  31.                         data_From_server = data_From_server + "name: " + name + " state: " + state + "<br>";
  32.                     }
  33.                     document.getElementById("output").innerHTML = data_From_server;
  34.                 }
  35.             });
  36.         }
  37.     </script>
  38.    
  39. </body>
Advertisement
Add Comment
Please, Sign In to add comment