Last active
December 17, 2015 10:59
-
-
Save mogya/5598977 to your computer and use it in GitHub Desktop.
send array as POST data on TitaniumMobile.
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
var paramstr = ''; | |
for (var key in params) { | |
if (params[key] instanceof Array){ | |
for (var i = 0; i < params[key].length; i++) { | |
paramstr = paramstr+key+'[]='+params[key][i]+'&'; | |
} | |
}else{ | |
paramstr = paramstr+key+'='+params[key]+'&'; | |
} | |
} | |
params = paramstr.slice(0,paramstr.length-1) | |
xhr.send(params); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment