Search code examples
javascriptjqueryparsingurlbuilding

jquery url builder/parser


I'm searching for a jquery plugin for full URL manipulation (parsing, building).

Example:

var url = 'http://mypage.com/?param=1'
var params = $.getParams(url) # {param: 1}
var newUrl = $.newUrl(url, {param:2}) # 'http://mypage.com/?param=2'

Thx.


Solution

  • There is this jquery plugin https://github.com/allmarkedup/jQuery-URL-Parser that I used once. But once you console.log window.location you will see that it is not so hard to do it your self.

    I never tried this one: http://urldecoderonline.com/javascript-url-decode-jquery-plugin.htm but it seems it can build URL to.

    Have fun