views:

68

answers:

4

Hi All,

Can anyone please tell me how can I pass a list item from one page to another in javascript?

Thanks

+1  A: 

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
jldupont
+3  A: 

You can use JSON. Perhaps as a querystring.

http://www.json.org/js.html

and

http://www.webmasterworld.com/forum91/216.htm

Pindatjuh
A: 

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

Upper Stage
A: 

Use ajax with JSON by POST ;)

PirosB3