<!DOCTYPE html> <html> <head> <title> jQuery param() </title> <script src="/ajax/libs/jquery/3.5.1/jquery.min.js"></script></head> <body> <h1> Welcome to the lidihuo.com </h1> <h2> This is an example of using the jQuery's param() method. </h2> <p> Click the following button to see the effect. </p> <button> Click me</button> <p id = "para"></p> <script> $(document).ready(function() { student = new Object(); student.Name = "John"; student.Rollno = "19"; student.Standard = "Fourth"; $("button").click(function() { $("#para").text($.param(student)).css("fontSize", "23px"); }); }); </script> </body> </html>
输出
Welcome to the lidihuo.com
This is an example of using the jQuery's param() method.
<!DOCTYPE html> <html> <head> <title> jQuery param() </title> <script src="/ajax/libs/jquery/3.5.1/jquery.min.js"></script></head> <body> <h1> Welcome to the lidihuo.com </h1> <h2> This is an example of using the jQuery's param() method. </h2> <p> Click the following button to see the effect. </p> <button> Click me</button> <p id = "p1"></p> <p id = "p2"></p> <script> $(document).ready(function() { var obj1 = new Object ({ a: [ 1, 2, 3 ] }); var obj2 = new Object ({ a: { b: 1, c: 2, d: 3}, e: [ 4, 5] }); $("button").click(function() { var res1 = decodeURIComponent( $.param(obj1)); $("#p1").text(res1); var res2 = decodeURIComponent( $.param(obj2)); $("#p2").text(res2); }); }); </script> </body> </html>
输出
Welcome to the lidihuo.com
This is an example of using the jQuery's param() method.