제이쿼리 질문이요 겟 파라메터..

제이쿼리 질문이요 겟 파라메터..

QA

제이쿼리 질문이요 겟 파라메터..

답변 1

본문

history.pushstate 를 이용해서 겟 파라메터로 브라우서 주소에 넣게 하는 작업하는데요

근데 filter_brand[]= 로 이루어진 파라메터 값이 중복 되는 현상이 있어서요

&filter_brand[]=가나다&filter_brand[]=가나다마바사& << 이렇게 중복 됩니다.

&filter_brand[]=가나다&filter_brand[]=마바사 << 이렇게 중복 안되야한데....

 

자꾸 중복이 되는데 중복 안되게 묶여진것만 넣고 싶은데 어떻게 해야될까요

 

일단 소스는 아래처럼 제이쿼리로 했구요


$(‘ul’>li>a’).function() {

var dataTatget = $(this).closest('li').children().data("target");
var dataValue = encodeURI($(this).closest('li').children().data("brand"));

filterParameter.push(dataTatget + "=" +dataValue);
history.pushState(null, null, renewUrl);
console.log(renewUrl);

});

 

<ul>

<li><a href="#" data-target="filter_brand[]" data-brand="가나다"><li>

<li><a href="#" data-target="filter_brand[]" data-brand="마바사"><li>

........

 

 

이 질문에 댓글 쓰기 :

답변 1

궁금증

 

$(‘ul’>li>a’).function() { ... } 

 

이렇게 접근을 하는데 

 

var dataTatget = $(this).closest('li').children().data("target");
var dataValue = encodeURI($(this).closest('li').children().data("brand"));

 

이렇게 써서 data인 target과 brand를 가져오는 이유는 무엇인가요?

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 123,732
© SIRSOFT
현재 페이지 제일 처음으로