how to get query string value using javascript
问题 i have an URL like the followin, http://test.com/testing/test/12345 12345 is the id. I want to take this using query string. How to take this value in javascript? 回答1: try like this http://test.com/testing/test/12345 var aarr = window.location.href.split('/'); //get last value var id = aarr[aarr.length -1]; or just var id = window.location.href.split('/').pop() 回答2: Use this : document.location.href.split('/').pop() Running it on this page yields : 22139563#22139563 回答3: Use this code: var id