如下有
data = {'userid':'xiaoming','sex':'f'}
var p = '' ; for(var i in data){ p += '&' + i + '=' + data[i] ; }
alert(p); //输出 &userid=xiaoming&sex=f