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 so that its serialized values can be used in the URL query string while making an AJAX request.


$ (selector).serialize()

jQuery serialize() example

Let's take an example which serializes a form values.

<!DOCTYPE html>
  <script src=""></script>
<form action="">
  First name: <input type="text" name="FirstName" value="Sonoo"><br>
  Last name: <input type="text" name="LastName" value="Jaiswal"><br>
<button>Serialize form values</button>
Note: Only successful controls are serialized to the string. It is not possible to serialize the form submitted by a submit button unless the form was submitted using a button.
Related Tutorial
Follow Us #
Contents +