How to create an object from the location/URL value in JavasScript/Jquery

Posted by DKinzer on Stack Overflow See other posts from Stack Overflow or by DKinzer
Published on 2010-04-23T17:40:04Z Indexed on 2010/04/23 17:43 UTC
Read the original article Hit count: 240

Filed under:
|
|

I need a way to create an object from a location value. For example if I have the value:

'http://www.legis.state.pa.us/cfdocs/billinfo/bill_history.cfm?syear=2007&sind=0&body=S&type=B&bn=1'

which I get from doc.location.href();

I would like to make the following object:

myObject = {

  syear : '2007',
  snid  : '0',
  body  : 's',
  type  : 'B',
  bn    : '1',

};

Thanks!

D

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript