Skip to content

Instantly share code, notes, and snippets.

@haoch
Created November 6, 2012 05:22
Show Gist options
  • Save haoch/4022745 to your computer and use it in GitHub Desktop.
Save haoch/4022745 to your computer and use it in GitHub Desktop.
encodeURI for tastypie RESTful api framework
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