반응형
250x250
Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
Tags
- node
- codebuild
- Python
- AWS CI/CD 구축하기
- bootstrap
- PostgreSQL
- Spring Error
- 도커
- IntelliJ
- Airflow
- codedeploy
- Flux
- JavaScript
- docker
- Spring
- redis
- VPN
- codedeploy error
- chart.js
- openlens
- chartjs
- SQL
- java bigdecimal
- Kafka
- codepipeline
- Jenkins
- COALESCE
- aws cicd
- kubeflow
- aws
Archives
- Today
- Total
Small Asteroid Blog
javascript json key, value 추출 본문
728x90
ajax 로 data를 받은 후
$.ajax({
type : "post",
url : "/getparam",
data : addrs,
datatype:'json',
success : function(data){
console.log("success > ",data);
getparam(data);
},
error:function (xhr, status, error){
console.log(error,xhr,status);
}
});//ajax
json 데이터의 key, value 값을 추출하고자 한다.
function getparam(data){
for (key in data){
console.log("key > ",key );
console.log("value > ",data[key] );
}
}
key값만 추출하는 것도 있다
let key1 = Object.keys(data);
let key2 = Object.getOwnPropertyNames(data);
//console.log("key1 > ",key1 ,", key2 > ",key2 );
728x90
반응형
'프론트엔드 > Javascript' 카테고리의 다른 글
| jquery string 으로 url 넘길 때 특수문자 사라지는 현상 해결(encodeURICpmponent) (0) | 2021.04.12 |
|---|---|
| [javascript] table row text 가져오기 (table td text ,tr text 데이터) (0) | 2021.04.12 |
| ajax xml 전체내용 출력 (0) | 2021.04.07 |
| dataTable 한국어 함수 (0) | 2021.02.15 |
| window.onload 와 $(document).ready 의 차이 (0) | 2021.02.15 |