How to extract GET variable with javascript?
PHP 같은 웹 어플리케이션 프로그램을 사용하지 않고도 GET 변수를 추출할 수 있다.
[code language="javascript" title="문서의 아무 부분에 넣어서 $_GET 변수를 작성한다"]
var $_GET = {};
document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function () {
function decode(s) {
return decodeURIComponent(s.split("+").join(" "));
}
$_GET[decode(arguments[1])] = decode(arguments[2]);
});
[/code]
사용방법
[code language="javascript" title="문서의 아무 부분에 넣어서 $_GET 변수를 작성한다"]
alert($_GET["boardID"]);
[/code]
Conversation
In the margins
0 notes
No comments yet. Be the first to leave a note.