Uncaught TypeError: Cannot read property 'route' of undefined 오류

Uncaught TypeError: Cannot read property 'route' of undefined 오류

QA

Uncaught TypeError: Cannot read property 'route' of undefined 오류

본문


"<p class='route_p'>" + your_offer_total[i].route + "</p>"+
Uncaught TypeError: Cannot read property 'route' of undefined

 

화면에서는 잘불러와서 잘 뿌려주는데;;

이후 스크립트가 다먹통되네요 

.

 

이건 콘솔에러구요..

your_selloffer_list.html:218 Uncaught TypeError: Cannot read property 'route' of undefined
    at HTMLDocument.<anonymous>
    at i (jquery-1.12.4.min.js:2)
    at Object.fireWith [as resolveWith] (jquery-1.12.4.min.js:2)
    at Function.ready (jquery-1.12.4.min.js:2)
    at HTMLDocument.K (jquery-1.12.4.min.js:2)
(anonymous) @ your_selloffer_list.html:218
i @ jquery-1.12.4.min.js:2
fireWith @ jquery-1.12.4.min.js:2
ready @ jquery-1.12.4.min.js:2
K @ jquery-1.12.4.min.js:2

이 질문에 댓글 쓰기 :

답변 2

에러내용으로만 보자면 your_selloffer_list.html 파일 218라인에 route라는 속성이 있는 모양인데

그것을 jquery에서 사용할려고 하는데 route값이 선언이 되어 있지 않아 생기는 에러로 보입니다.

그 부분을 잘 살펴 보세요.

 

your_offer_total[i] 이 정의되지 않아서 뜨는 에러 같은데요, your_offer_total[i] 값을 콘솔에 찍어서 확인해보시면 될것 같습니다.

var pricewop = [
        {
            "price" : 950
        },
        {
            "price" : 900
        },
        {
            "price" : 850
        },
        {
            "price" : 800
        }
    ];

 

이렇게 데이터를 만들고


    for(var i = 0; i <= pricewop.length ; i++){
        var search_view =
            "<li>"+ pricewop[i].price +"</li>";
        $('.message_board3 .list_pride ul').append(search_view);
     
    }

 

 

에 사용하면 화면에서는 숫자가 나오는데.

콘솔창에서는 Uncaught TypeError: Cannot read property 'price' of undefined 라는 에러가 나오고

아래 스크립트 부터는 읽지를 못합니다.

 

어디서 틀린건지 알수있을까요?

 
 콘솔창 에러위치는  "<li>"+ pricewop[i].price +"</li>"; 입니다

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

회원로그인

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