Hi, we'll check.
Hi, we'll check.
Looks like there is no need to update existing code as app created with this tutorial works as expected.
Yes, the application works fine, but only until you try to post a tweet with special characters * ) ( ! ... the code of serialization is incomplete ![]()
Hi Diego,
We'll check, thank you for reporting this.
Hi Diego,
Please clarify, what symbols you can't post?
We can use the following symbols without any problem:
code{}[]|?., ) ( ! @#!$%^&()_+-/code
Hi Katya!
I can't use the next symbols:
code * ! ) ( /code
I think that is because I did not include the following code in my application:
[quote:]//correct replacement instead of standard from jQuery.
// to force array serialization
Code: Select all
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
} });
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
[/quote]
But, it was not included in my application because following the tutorial I'm not clear where add it.
I leave a picture of error displayed here.
And here is the public link of my application.
Thanks for your comments,
Diego,
Fixing will take some time...
Ok, I will be attentive
Hi Diego,
Sorry, there is an incorrect piece of code in our tutorial. Replace this code:
precode//correct replacement instead of standard from jQuery.
// to force array serialization
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && jQuery.type( obj ) === "object" ) {// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {// Serialize scalar item.
add( prefix, obj );
}
}/code/pre
with the following:precode//correct replacement instead of standard from jQuery.
jQuery.param = function( a, traditional ) {
var prefix,
s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
s[ s.length ] = EncodeHelper.encodeSymbols( key ) + "=" + EncodeHelper.encodeSymbols( value );
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
}
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
});
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for ( prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" ).replace( /%20/g, "+" );
};
function buildParams( prefix, obj, traditional, add ) {
var name;
if ( jQuery.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
Code: Select all
} else {
// If array item is non-scalar (array or object), encode its
// numeric index to resolve deserialization ambiguity issues.
// Note that rack (as of 1.0.0) can't currently deserialize
// nested arrays properly, and attempting to do so may cause
// a server error. Possible fixes are to modify rack's
// deserialization algorithm or to provide an option or flag
// to force array serialization to be shallow.
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
} });
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}/code/pre