개발/JQUERY
제이쿼리(Jquery) 파라메터 가져오기
료팡
2017. 3. 15. 09:41
$.extend({
getUrlVars: function() {
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).toUpperCase().split('&');
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
},
getUrlVar: function(name) {
return $.getUrlVars()[name.toUpperCase()];
}
});
요로케 확장해서 쓰자
type = $.getUrlVar('type');
요론식으로 꺼내서 쓰면 편하지