Copyright © tutorialspoint.com
This method turns an object into its URL-encoded query string representation.
This is a form of serialization, and is mostly useful to provide complex parameter sets for stuff such as objects in the Ajax namespace (e.g. Ajax.Request).
Object.toQueryString(obj); |
<html> <head> <title>Prototype examples</title> <script type="text/javascript" src="/javascript/prototype.js"> </script> <script> function showResult(){ var o = { action: 'ship', order_id: 123, fees: ['f1', 'f2'], 'label': 'a demo' }; alert("URI: " + Object.toQueryString(o) ); } </script> </head> <body> <p>Click the button to see the result.</p> <br /> <br /> <input type="button" value="Result" onclick="showResult();"/> </body> </html> |
To understand it in better way you can Try it yourself.
Copyright © tutorialspoint.com