2017-01-20 4 views
0

개발자 도구를 사용하여 api 호출 결과를 볼 수 있지만 PHP없이 html로 결과를 표시 할 수있는 지식이 부족합니다. 그것은 여기에, 도움이 응답의 작은 샘플의 경우PHP를 사용하지 않고 div에 json 응답을 표시하려합니다.

objectcount ...

<!DOCTYPE html> 
<html lang="en"> 
<head> 
<meta charset="utf-8"> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<meta name="Content-Script-Type" content="text/javascript"> 
<script type="text/javascript" src="js/jquery-1.11.3.min.js" rel="jquery" > </script> 
<meta name="Content-Style-Type" content="text/css"> 
</head> 

<body style="margin: 0px; padding: 0px;"> 

<div id="fullscreen"> 
<div id="output"> 

</div> 

</div> 

</body> 
<script> 
$.ajax({ 
type: 'GET', 
url: "https://avacmd25.scala.com:44335/ContentManager/api/rest/players?limit=1&offset=0&sort=name", 
dataType: "json", 

success: function(response) { 
     console.log(response); // server response 
     var id = response[0];  
     var vname = response[1]; 
     $('#output').html("<b>id: </b>"+id+"<b> name: </b>"+vname); 
} 
}); 
</script> 
</html> 

: 36list : 배열 [1] 0 : Objectactive "HEARTBEAT_OVERDUE"여기

내 코드입니다 distributionServer : ObjectdownloadThreads : 1nabled : trueid : 31lastModified : "2016-12-20 18:26:27"logLevel : "normal"mac : "00-00-00-00-00-

답변

0

댓글을 게시 할 수 없습니다 아직 질문을 드리겠습니다. 응답을 배열로 보내시겠습니까? 그렇다면 json_encode 번을 사용하고 있습니까? 배열에? 인코딩하지 않은 경우 사용자가받는 응답을 설명 할 수 있습니다.

+0

나는 응답이 배열로 돌아오고 있다고 믿는다. 예 ... json encode는 PHP없이 가능합니까? – KevMoe

관련 문제