Advertisement
Guest User

Untitled

a guest
Oct 17th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(
  2.     function() {
  3.        
  4.         $.getJSON( 'http://hyonteiset.luomus.fi/insects/rest/authentication?username=abc&password=123' )
  5.        
  6.         $.ajax({  
  7.             url: 'http://hyonteiset.luomus.fi/insects/rest/search/Araneae',
  8.             data: {
  9.                 region: 'Oba',
  10.                 select: 'DISTINCT family,speciesName'
  11.             },    
  12.             dataType: 'json'
  13.         }).done(function( data, textStatus, xhr ) {    
  14.             var list = '';
  15.    
  16.             for ( var i=0; i<data.length; i++ )
  17.             {
  18.                 list = list + data[i].family + " " + data[i].speciesName + '<br>';
  19.             }
  20.             $('#result').html( list );
  21.         }).fail(function( xhr ) {  
  22.             $('#result').html( xhr.status + ' ' + xhr.statusText + ' ' + xhr.responseText );
  23.         });
  24.     }
  25. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement