무소의 뿔처럼
js 파라미터 값 가져오기. 본문
모든값
const searchParams = new URLSearchParams(location.search);
for (const param of searchParams) {
console.log(param);
}
특정값
const urlParams = new URL(location.href).searchParams;
const name = urlParams.get('name');
더보기
function clickDelBtn(){
const urlParmas = new URL(location.href).searchParams;
const list = urlParmas.get("list");
const ans = confirm('정말 삭제하시겠습니까?');
if(!ans) {
location.href="/detail?list="+list;
return false;
}
location.href="/delete.do?list="+list;
return true;
}
'알아두기 > JavaScript' 카테고리의 다른 글
jquery download URL (0) | 2023.03.30 |
---|
Comments