Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • jQuery.param() method in jQuery

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 43
    Comment on it




    object: object parameter in param method is an array, a plain object, or a jQuery object which needs to be  serialized.

    traditional: This parameter is a boolean indicating whether a traditional "shallow" serialization is to be performed.

    Advantage of using jQuery.param() method is it creates a serialized representation of an array,an object or a jQuery object thus returning a string. When a jQuery object is passed, it should contain input elements with name/value properties. The serialized values then can be used in the URL query string when making an AJAX request.

    Program using param() method:

    <!DOCTYPE html>
    <script src=""></script>
       var myObject = {
        a: {one: 1,two: 2,three: 3},
        b: [1, 2, 3]}; 
        var a = $.param(myObject);
        var b = decodeURIComponent($.param(myObject));
    <button id="btn1">Serialize object</button>
    <button id="btn">DeSerialize object</button>

    In the program above 2 buttons are created on click of first button serialized data is alerted using param() method while clicking on second button the same data is deserialized using decodeURIComponent.The conversion of the passed object into a stream of data so that it can be easily transmittable over the network is done by the The param() method. The serialized data converted by param() method can be defined as a linear stream of data that which are useful to be passed across process boundaries and machines.

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: