Created
          February 9, 2014 04:28 
        
      - 
      
 - 
        
Save billychan/8894271 to your computer and use it in GitHub Desktop.  
    Parse query string in Javascript
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # Raw Javascript functions | |
| window.parseQueryString = -> | |
| query = (window.location.search || '?').substr(1) | |
| map = {} | |
| query.replace(/([^&=]+)=?([^&]*)(?:&+|$)/g, (match, key, value) -> | |
| (map[key] = map[key] || []).push(value) | |
| ) | |
| return map | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment