If you throw away all the details, then what happens in your case:
jQuery.post- which calls
jQuery.ajaxinternally to execute ajax - which calls
jQuery.paraminside to build a query string
, new String , in jQuery.ajax (typeof new String("foo") === "object", not "string"):
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
}
jQuery.param :
for ( var prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
, for in , .
:
var x = new String("abc");
for(var i in x) {
console.log(i, x[i]);
}