Created
November 6, 2012 05:22
-
-
Save haoch/4022745 to your computer and use it in GitHub Desktop.
encodeURI for tastypie RESTful api framework
This file contains 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
function encodeURI(params){ | |
var request_url=[]; | |
for(var i in params){ | |
var target = params[i]; | |
if(typeof target =='object'){ // when is list | |
for(var j in target){ | |
request_url.push(i+"="+target[j]); | |
} | |
}else{ | |
request_url.push(i+"="+params[i]) | |
} | |
} | |
return endcodeURI(request_url.join('&')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment