开发者

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:

  1. push the list item through ajax
  2. 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 ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜