passing list item in javascript
Can anyone please tell me how can I pass a list开发者_开发知识库 item from one page to another in javascript?
Thanks
You can use JSON. Perhaps as a querystring.
http://www.json.org/js.html
and
http://www.webmasterworld.com/forum91/216.htm
Assuming same origin:
Through the server:
- push the list item through ajax
- use cookies
Through local host:
- Use WebLocalStorage facility of HTML5
- Use Gears database
- Build a link to the page and use a "query" in the URI
I assume the data required by the second page is available on the server. If not, the first page should send it to the server via AJAX.
In either case, use JSTL on the server to create a data structure in JavaScript which is read by the second page after it loads
Use ajax with JSON by POST ;)
精彩评论