How to Use param() method in JQuery
In this article I have described how to serialize the information with the help of param() method in JQuery.
Serialization of Information
- If we want to serialize the information about user, then it we can use JQuery.
- For this purpose we use param() method to represent data of an array and an object in a serialized way.
Syntax
<script type="text/javascript">
$(document).ready(function ()
{
$("button").click(function () {
$("div").text($.param(information));
});
});
</script>
|
Lets take an example
<!DOCTYPE html>
<html>
<head>
<script src="jquery-1.7.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function ()
{
information = new Object();
information.city = "haldwani" ;
information.district = "nainital";
information.state = "Uttarakhand";
information.countory = "India" ;
$("button").click(function () {
$("div").text($.param(information));
});
});
</script>
</head>
<body style="background:yellow">
<button>Serialize information</button>
<div></div>
</body>
</html>
|
Above program serialize the information given by user
OUTPUT
When we run above program we have
You may also want to read these related articles Click here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here