Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Jquery serialize function.

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 194
    Comment on it

    Hello Readers ,

    jQuery serialize() method is used to create a text string in standard URL-encoded notation.

    It is used in form controls like input, textarea, select etc.

    It serializes the form values in such a way so that its serialized values can be used in the URL query string while making an AJAX request.

    Syntax :

    $ (selector).serialize()  
    

    Example:

    <!DOCTYPE html>  
    <html>  
    <head>  
      <script src="https://code.jquery.com/jquery-1.10.2.js"></script>  
    <script>  
    $(document).ready(function(){  
        $("button").click(function(){  
            $("div").text($("form").serialize());  
        });  
    });  
    </script>  
    </head>  
    <body>  
    <form action="">  
      First name: <input type="text" name="FirstName" value="Sonoo"><br>  
      Last name: <input type="text" name="LastName" value="Jaiswal"><br>  
    </form>  
    <button>Serialize form values</button>  
    <div></div>  
    </body>  
    </html>  
    

    Output :

    FirstName=Sonoo&LastName=Jaiswal
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
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: