Created
March 18, 2015 00:43
-
-
Save divinity76/be5d4bbd05f48c1bb55e to your computer and use it in GitHub Desktop.
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 MyFormData(){ | |
var data=[]; | |
this.append=function append(name,value){ | |
data.push([name.toString(),value.toString()]); | |
}; | |
this.toString=function toString(){ | |
var ret=""; | |
encodeURIComponent | |
var i=0; | |
for(;i<data.length;++i){ | |
ret+=encodeURIComponent(data[i][0])+"="+encodeURIComponent(data[i][1])+"&"; | |
} | |
if(data.length>0){ | |
ret=ret.slice(0,-1); | |
} | |
return ret; | |
}; | |
this.valueOf=function valueOf(){ | |
return this.toString(); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment