Return to Snippet

Revision: 47604
at June 11, 2011 04:16 by anagaiyahoocom


Initial Code
/**
	* Will convert a url query string key=val&key=val format into an object
	*
	* @param string str Url query string
	* @return object
	*/
	
	my.explode_to_object = function(str) {
		var cArr = str.split('&');
		var cObj = {};
		var cLen = cArr.length;
		for(var cnt=0;cLen--;cnt++) {
			var cStr = new String(cArr[cnt]);
			var cElem = cStr.split('=');
			cObj[cElem[0]] = cElem[1];
		}
		
		return cObj;
	}

Initial URL

                                

Initial Description

                                

Initial Title
Convert Url query string key/value Format Into Object

Initial Tags
javascript

Initial Language
JavaScript