ajax로 원하는 값만 받고싶어요.

ajax로 원하는 값만 받고싶어요.

QA

ajax로 원하는 값만 받고싶어요.

본문

▼html소스


<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
<script>
$.ajax({
    type : "get",
    url: '/exec/front/board/product/4?no=3',
    success: function(data) {
        var img = data.read['content_image'];
        $("#example").append(img);
    }
});
</script>
<div id="example"></div>

 

▼url파일



	
		
			 
			{"failed":false,"msg":"","data":{"no":3,"bulletin_no":4,"subject":"\ub108\ubb34 \uc774\ubed0\uc694","content":"<p>\ud0a4- 180<\/p><p>\ubab8\ubb34\uac8c- 74<\/p><p>\ucc29\uc6a9\uc0ac\uc774\uc988- free<\/p><p>\uac1c\uc778\uc801\uc778 \ucf54\uba58\ud2b8-<\/p><p>\uc18c\ub77c\uc0c9 \ub2c8\ud2b8\uac00 \ub108\ubb34 \uc774\ubed0\uc11c \ub0a8\uc790\uce5c\uad6c \uc120\ubb3c\ub85c \uad6c\ub9e4\ud588\uc2b5\ub2c8\ub2e4. \uc6b8 \ud568\ub7c9\uc774 \ub192\uc544\uc11c \uc774\ub108\ub97c \ucc59\uaca8 \uc785\uc5b4\uc57c \ud558\uc9c0\ub9cc \ub530\ub4ef\ud558\ub370\uc694!<\/p><p>\ud54f\ub3c4 \ub108\ubb34 \uc774\uc058\uace0 \ud568\uaed8 \uad6c\ub9e4\ud55c \ub77d\ucee4\ub8f8 \ubc14\uc9c0\ub791 \ucf54\ub514\ud558\ub2c8\uae4c \uc644\uc804 \ucc30\ub5a1!!<\/p><p>\uad6c\uc785\ud6c4 \uc138\uc77c\ud574\uc11c \uc18d\uc740..\uc0c1\ud558\uc9c0\ub9cc \uadf8\ub798\ub3c4 \ub0a8\uc790\uce5c\uad6c\uac00 \uc88b\uc544\ud558\ub2c8 \ub9cc\uc871\uc785\ub2c8\ub2e4! \ub0a8\uce5c \uc637\uc740 \uc5ed\uc2dc \ub77d\ucee4\ub8f8\u314b\u3137<\/p>","content_image":"<img src=\"\/\/ecudemo144423.cafe24.com\/file_data\/ecudemo144423\/2020\/02\/08\/0ece48f30fcc3e1d266ef3204a0cc5c1.jpeg\" border=\"0\" alt=\"\" \/><br><img src=\"\/\/ecudemo144423.cafe24.com\/file_data\/ecudemo144423\/2020\/02\/08\/e77711b20617906daf014470e3a6e22a.jpeg\" border=\"0\" alt=\"\" \/><br>","thumbnail_image":"<img src=\"\/\/ecudemo144423.cafe24.com\/file_data\/ecudemo144423\/\/2020\/02\/08\/0ece48f30fcc3e1d266ef3204a0cc5c1.jpeg\" height=\"80\" alt=\"\" \/>","writer":"<a href='#none' onclick=EC_BOARD_ADMIN.member_info('ecudemo144423','ecudemo144423');>\uc1fc\ud551\ubab0 \uc774\ub984(ecudemo144423)<\/a>","hit_count":140,"write_date":"2020-02-08 17:06:23","write_date_original":"2020-02-08 17:06:23","attach_file":"<a href=\"#none\" onclick=\"BOARD_READ.file_download('\/exec\/front\/Board\/download\/?no=3&realname=2020\/02\/08\/0ece48f30fcc3e1d266ef3204a0cc5c1.jpeg&filename=2-1.jpeg');\">2-1.jpeg<\/a> , <a href=\"#none\" onclick=\"BOARD_READ.file_download('\/exec\/front\/Board\/download\/?no=3&realname=2020\/02\/08\/e77711b20617906daf014470e3a6e22a.jpeg&filename=2-2.jpeg');\">2-2.jpeg<\/a> ","ip":"","consult":"X","point_icon":"<img src=\"\/\/img0001.echosting.cafe24.com\/front\/type_b\/image\/common\/star_off.gif\" alt=\"\" class=\"ec-common-rwd-image\" \/><img src=\"\/\/img0001.echosting.cafe24.com\/front\/type_b\/image\/common\/star_off.gif\" alt=\"\" class=\"ec-common-rwd-image\" \/><img src=\"\/\/img0001.echosting.cafe24.com\/front\/type_b\/image\/common\/star_off.gif\" alt=\"\" class=\"ec-common-rwd-image\" \/><img src=\"\/\/img0001.echosting.cafe24.com\/front\/type_b\/image\/common\/star_off.gif\" alt=\"\" class=\"ec-common-rwd-image\" \/><img src=\"\/\/img0001.echosting.cafe24.com\/front\/type_b\/image\/common\/star_off.gif\" alt=\"\" class=\"ec-common-rwd-image\" \/>","point_display":"","point_count":5,"member_icon":"","vote_count":0,"secret_passwd":"F","param_list":"?board_act=list&board_no=4","param_modify":"?board_act=edit&no=3&board_no=4","param_reply":"","icon_mobile":"","link_board_list":"\/board\/\uc0c1\ud488-\uc0ac\uc6a9\ud6c4\uae30\/4\/","ucc_url":""}}
		
	


 

 

밑의 소스에서 content_image 부분의 값만출력하고싶은데 안되네요.ㅠ

혹시 뭐가 문제인지 알 수 있을까요?

이 질문에 댓글 쓰기 :

답변 2

url: ~~~,

dataType: "json",

success: function(data) {

저 부분을 넣으신 후에

 

var img = data.read['content_image'];

이걸

var img = data.data.content_image;

이렇게 바꿔 보세요.

var img = data.data.content_image;
 

답변을 작성하시기 전에 로그인 해주세요.
전체 150
QA 내용 검색
filter #json ×

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT