728x90
<script>
var test = location.search;
console.log('test',test);
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
var patId = getParameterByName('id'); // 1060192
console.log('patId',patId);
</script>
출처 : https://fellowtuts.com/jquery/getting-query-string-values-in-javascript/?a=a
'개념 정리' 카테고리의 다른 글
Jpa toEntity (0) | 2022.08.26 |
---|---|
객체 => Object (0) | 2022.08.26 |
css에서 요소에 스타일 줄 때 (0) | 2022.08.04 |
현재 프론트 jpa 페이지 javascript 정리 개념 풀이 (0) | 2022.08.04 |
만들어진 변수 return (0) | 2022.08.02 |