jQuery param() Method

jQuery param() Method create a serialized representation of an array or a plain object. The serialized values can be used in the URL query string when making an AJAX request . In case a jQuery object is passed, it should contain input elements with name/value properties .
studentObj = new Object(); studentObj.firstname = "John"; $("p").text($.param(studentObj));
run this source code Browser View

Full Source
<html> <head> <title>jQuery param() example</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ studentObj = new Object(); studentObj.firstname = "John"; studentObj.lastname = "Doe"; studentObj.age = 8; studentObj.grade = "2"; $("button").click(function(){ $("p").text($.param(studentObj)); }); }); </script> </head> <body> <button>jQuery param() example</button> <p></p> </body> </html>