jQuery serialize() method basically use for URL-encoded purpose. Please see below example:-

<!DOCTYPE html>  
<html>  
<head>  
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>    
<script>  
$(document).ready(function(){  
    $("button").click(function(){  
        $("div.result").text($("form").serialize());  
    });  
});  
</script>  
</head>  
<body>  
<form action="">  
  First name: <input type="text" name="Fname" value="jai"><br>  
  Last name: <input type="text" name="Lname" value="puri"><br>  
</form>  
<button>Serialize</button>  
<div class="result"></div>  
</body>  
</html>  

Result:- Fname=jai&Lname=puri

Your Answer
Sign In
Enter email and password to comment or answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.