MCPcopy Create free account
hub / github.com/apache/cloudstack / buildParams

Function buildParams

tools/ngui/static/js/lib/jquery-1.7.2.js:7769–7799  ·  view source on GitHub ↗
( prefix, obj, traditional, add )

Source from the content-addressed store, hash-verified

7767});
7768
7769function buildParams( prefix, obj, traditional, add ) {
7770 if ( jQuery.isArray( obj ) ) {
7771 // Serialize array item.
7772 jQuery.each( obj, function( i, v ) {
7773 if ( traditional || rbracket.test( prefix ) ) {
7774 // Treat each array item as a scalar.
7775 add( prefix, v );
7776
7777 } else {
7778 // If array item is non-scalar (array or object), encode its
7779 // numeric index to resolve deserialization ambiguity issues.
7780 // Note that rack (as of 1.0.0) can't currently deserialize
7781 // nested arrays properly, and attempting to do so may cause
7782 // a server error. Possible fixes are to modify rack's
7783 // deserialization algorithm or to provide an option or flag
7784 // to force array serialization to be shallow.
7785 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
7786 }
7787 });
7788
7789 } else if ( !traditional && jQuery.type( obj ) === "object" ) {
7790 // Serialize object item.
7791 for ( var name in obj ) {
7792 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
7793 }
7794
7795 } else {
7796 // Serialize scalar item.
7797 add( prefix, obj );
7798 }
7799}
7800
7801// This is still on the jQuery object... for now
7802// Want to move this to jQuery.ajax some day

Callers 1

jquery-1.7.2.jsFile · 0.85

Calls 3

addFunction · 0.70
testMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected