2013-01-09 3 views
1

안녕하세요. API를 사용하는 데 익숙하지 않고 cineworld API에서 정보를 얻으려는 데 문제가 있습니다. 아무도 사용하지 않았습니다.cineworld api 정보 blank

여기에 나와있는 예가 있지만 정보를 가져올 수 없습니다.

<script> 
$(document).ready(function() { 
$('a.retrieve').click(function() { 
    $.ajax({ 
     url: '/api/quickbook/films', 
     type: 'GET', 
     data: {key: 'qUnEyRXt', full: true, cinema: 33}, 
     dataType: 'jsonp', // Setting this data type will add the callback parameter for you 
     success: parseFilms 
    }); 
}); 

$('a.clear').click(function() { 
    $('span.film.count').text('0'); 
    $('ol.film.list').empty(); 
}); 
}); 

function parseFilms(response, status) { 
var html = ''; 

// Check for errors from the server 
if (response.errors) { 
    $.each(response.errors, function() { 
     html += '<li>' + this + '</li>'; 
    }); 
} else { 
    $('span.film.count').text(response.films.length); 
    $.each(response.films, function() { 
     html += '<li>' + this.title + ' (' + this.classification + ')</li>'; 
    }); 
} 

// Faster than doing a DOM call to append each node 
$('ol.film.list').append(html); 
} 


</script> 

웹 documation 링크가 실제로

+0

+1에게 있습니다 : 여기

$.ajax()에을 통과하고있는 URL입니다. 감사. –

+0

api 키를 넣으시겠습니까? – Chris2048

답변

0

작정 큰 감사를 것 https://www.cineworld.co.uk/developer/jquery

어떤 도움이나 조언이다, 그것을 작동합니다!

여기 http://www.cineworld.co.uk/api/quickbook/films?key=qUnEyRXt&full=true&cinema=33

이 Cineworld API의 데이터를 표시하기위한 코드

<html> 
    <head> 
    <script type="text/javascript" src="jquery.js"></script> 
    <script type="text/javascript"> 
     $(document).ready(function() { 
     $('a.retrieve').click(function() { 
      $.ajax({ 
       url: 'http://www.cineworld.co.uk/api/quickbook/films', 
       type: 'GET', 
       data: {key: 'qUnEyRXt', full: true, cinema: 33}, 
       dataType: 'jsonp', // Setting this data type will add the callback parameter for you 
       success: parseFilms 
      }); 
     }); 

     $('a.clear').click(function() { 
      $('span.film.count').text('0'); 
      $('ol.film.list').empty(); 
     }); 
     }); 

     function parseFilms(response, status) { 
     var html = ''; 

     // Check for errors from the server 
     if (response.errors) { 
      $.each(response.errors, function() { 
       html += '<li>Error' + this + '</li>'; 
      }); 
     } else { 
      $('span.film.count').text(response.films.length); 
      $.each(response.films, function() { 
       html += '<li>' + this.title + ' (' + this.classification + ')</li>'; 
      }); 
     } 

     // Faster than doing a DOM call to append each node 
     $('ol.film.list').html(html); 
     } 
    </script> 
    </head> 
    <body> 
    <a class="retrieve" href="#retrieve">Retrieve</a> 
    <a class="clear" href="#clear">Clear</a> 
    <span class="film count"></span> 
    <ol class="film list"> 
    </ol> 
    </body> 
</html> 
+0

그건 그렇고, 그냥 사이드 노트에 조언. 따라서 json 문자열을 읽을 수 있습니다. 브라우저에 json reader 플러그인을 다운로드 할 수 있습니다. –

+0

감사합니다 남자, 이것은 방대한 도움이됩니다! –