Loading Please Wait...

Logo Lynxsia IT Solutions

jQuery AJAX Serialize

JQ AJAX Serialize

With jQuery you can encodes a set of form elements as a string or as an array of names and values for submission.

jQuery serialize() Method

The serialize() method creates a URL encoded text string by serializing form values.

You can select one or more form elements (like input and/or text area), or the form element itself.

The serialized values can be used in the URL query string when making an AJAX request.

Syntax
					 
        
          $(selector).serialize()
        
      
Example

The following example output the result of serialized form values:

					 
        
          $("button").click(function(){
            $("div").text($("form").serialize());
          });
        
      
jQuery serializeArray() Method

The serializeArray() method creates an array of objects (name and value) by serializing form values.

You can select one or more form elements (like input and/or text area), or the form element itself.

Syntax
					 
        
          $(selector).serializeArray()
        
      
Example

The following example output the result of form values serialized as arrays:

					 
        
          $("button").click(function(){
            var x = $("form").serializeArray();
            $.each(x, function(i, field){
              $("#results").append(field.name + ":" + field.value + " ");
            });
          });
        
      

How you feel about this blog:

Share this blog on:

Report Us

If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com

Contact Us
Ads
Logo
Lynxsia IT Solutions

We are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..

Kotwali Road, Chhiptehri, Banda, 210001, UP, India

Copyright © 2022, Lynxsia IT Solutions, All rights reserved