안녕하세요.
$.ajax({
url : 'http:/ABC.COM/abcdefg'
,type : 'GET'
,cache : false
,contentType : 'application/json; charset=utf-8'
,dataType : 'json'
,success : function(result) {
//alert(result);
console.log(result);
}
,error:function(request,status,error){
alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
}
});
위와 같이 URL을 GET으로 호출해서 다음과 같은 값을 받았습니다.
result:
country: "0"
created: "2020-05-15T02:22:55+09:00"
credit: "0"
dirty: "-"
nick: "abcdefg"
status: "active"
id: "abcdefg"
updated: "0001-01-01T00:00:00Z"
console.log에 이렇게 나오는데요
이게 값을 불러온게 맞나요? 불러온것이 맞다면 위 값중에 nick인 abcdefg만 출력하려면 어떻게 해야되나요?
|
답변 2개 / 댓글 2개
채택된 답변
+20 포인트
2020-05-14 (목) 18:58:26
alert(result.nick);
쟁반님께서 답변주셨네요 저대로 하면됩니다
답변에 대한 댓글 2개
kujira
2020-05-15 (금) 10:47:32
console.log로 찍히는 데이터를 php변수에 담아야 json_decode로 배열화 하텐데 console.log로 찍히는 데이터를 php변수로 담는법을 모르겠습니다...ㅠㅠ
답변을 작성하려면 로그인이 필요합니다.