How to use param() Method in JQuery AJAX
In this article, I will explain use of param() Method in JQuery AJAX.
JQuery AJAX param() Method
- param() method creates a serialized representation of an array or an object.
- In param() method, the serialized values can be used in the URL query string when making an AJAX request.
Syntax
$(selector).param(object,trad)
|
Example
The following example show the use of param() method.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function () {
personObj = new Object();
personObj.firstname = "Dinesh";
personObj.lastname = "Sharma";
personObj.age = 35;
personObj.eyecolor = "blue";
$("button").click(function () {
$("div").text($.param(personObj));
});
});
</script>
</head>
<body>
<h2>param() Method Example</h2>
<button>Click for Serialize object</button>
<div></div>
</body>
</html>
|
Output
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