Author:
erics , September 23rd, 2011
var Params = jQuery . param ( {
'pagenum' : 16 ,
'pageqty' : 10 ,
} ) + '&' + jQuery ( '#yourForm' ) . serialize ( ) ;
Categories: How-To's , Technology Tags: GET , howto , javascript , JQuery , param , params , POST , Serialize , tips
| No comments
Author:
erics , May 23rd, 2011
A very simple deserializer. I am sure it can be streamlined… Also, note the use of the “while (i–)” construct. This is the best-performing Javascript loop method.
var Params = jQuery ( '#yourForm' ) . serialize ( ) ;
var yourHash = deserialize ( Params ) ;
alert ( yourHash . yourVariable ) ;
function deserialize ( Params ) {
var Data = Params . split ( "&" ) ;
var i = Data . length ;
var Result = { } ;
while ( i -- ) {
var Pair = decodeURIComponent ( Data [ i ] ) . split ( "=" ) ;
var Key = Pair [ 0 ] ;
var Val = Pair [ 1 ] ;
Result [ Key ] = Val ;
}
return Result ;
}
Categories: How-To's , Technology Tags: Deserialize , Deserializer , howto , javascript , Serialize , tips
| 1 comment