테스트 사이트 - 개발 중인 베타 버전입니다

jquery문의드립니다. 채택완료

미돌돌 4년 전 조회 1,805

테마의 shop 인덱스 파일에 아래와 같은 제이쿼리를 추가했는데

alert 팝업창이 떠야 정상이나 정삭적으로 작동되지 않습니다.

고수님들의 조언 구해봅니다.

 

        
                           

댓글을 작성하려면 로그인이 필요합니다.

답변 2개

채택된 답변
+20 포인트

</p>

<p><style>

    #search_property {

        margin: 0 auto;

        text-align: center;

        margin-top: 15px;

        margin-bottom: 30px;

    }

    #search_property input[type='datetime-local'] {

        width: 240px;

        height: 35px;

        outline: 0px solid red;

    }

    #search_property input[type='button'] {

        width: 80px;

        color: white;

        background: pink;

        height: 35px;

        border: 0px solid  red;

        border-radius: 5px;

        outline: 0px solid red;

    }

    #search_property input:not(:last-child) {

        margin-right: 25px;

    }

</style>

<script>

function searchProperties() {

    var data = { "checkin":"", "checkout": "","person":"","region":"","cities":""};

    $.ajax({

        type: "POST",

        url: "<a href="http://www.naver.com"," target="_blank" rel="noopener noreferrer">http://www.naver.com",</a>

        dataType: "JSON",

        data: data,

        success: function (result) {

            if(result){             

              console.log(result)

            }

        },

        error: function (xhr, status, error) {

             

        }

        });

}

$(document).ready(function() {

    alert('****');

    $("#searchButton").click(function(){

        console.log("------");

      searchProperties(); 

    })

});</p>

<p></script>

<div>

   

    <div id="search_property">

      <input type="datetime-local" name="checkinDate"/>

      <input type="datetime-local" name="checkoutDate"/>

      <input type="button" value="검색" id="searchButton"/>

    </div></p>

<p>

 

오류 디버깅을 하실떄는 개발자 도구를 켜두고 확인하시면 됩니다

 

위 소스로 해보세요

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

미돌돌
4년 전
너무너무 감사합니다.
덕분에 잘 해결되었습니다!

댓글을 작성하려면 로그인이 필요합니다.

1. 

    $("#searchButton").click(function(){         console.log("------");       searchProperties();       })

 

이부분 console.log 로 수정하신후 ------- 출력되는지 확인

 

2. searchProperties 함수 부분에서 

conse.log("------");  이부분 console.log("------"); 로 바꾸고 제대로 출력되는지 확인

 

alert 가 안뜬다는게 alert('****'); 이부분이신거 같은데

console.log <= 이부분 오타 때문인거같습니다

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

미돌돌
4년 전
답변 감사합니다.
덕분에 오타 부분 확인해서 아래처럼 수정했는데 출력이 되지 않습니다.
어떤 부분의 문제일까요

<style>
#search_property {
margin: 0 auto;
text-align: center;
margin-top: 15px;
margin-bottom: 30px;
}
#search_property input[type='datetime-local'] {
width: 240px;
height: 35px;
outline: 0px solid red;
}
#search_property input[type='button'] {
width: 80px;
color: white;
background: pink;
height: 35px;
border: 0px solid red;
border-radius: 5px;
outline: 0px solid red;
}
#search_property input:not(:last-child) {
margin-right: 25px;
}
</style>
<script>
function searchProperties() {
var data = { "checkin":"", "checkout": "","person":"","region":"","cities":""};
$.ajax(
type: "POST",
url: "http://www.naver.com",
dataType: "JSON",
data: data,
success: function (result) {
if(result){
console.log(result)
}
},
error: function (xhr, status, error) {

});
}
$(document).ready(function() {
alert('****');
$("#searchButton").click(function(){
console.log("------");
searchProperties();
})
});

</script>
<div>

<div id="search_property">
<input type="datetime-local" name="checkinDate"/>
<input type="datetime-local" name="checkoutDate"/>
<input type="button" value="검색" id="searchButton"/>
</div>

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인