How do I "pass" (POST/GET??) a jQuery selection set from one page to another?
Specifically, I'm talking about passing an XML node, but the process would be the same for passing a <div> tag and its contents, right?
On the first page, I use jQuery to parse an XML file, then when the user clicks a link, I want to pass a reference to a child XML node (depending on which link they click) to the 2nd page.
Then, the 2nd page will have some jQuery that will parse the child node.
you can only pass strings, not objects like nodes.
you can use cookies or localStorage to pass strings.
Really? I can only pass strings using GET/POST?
Can you help me understand these examples from jQuery's Documentation?
Code:
//Example: Request the test.php page and send some additional data along (while still ignoring the return results).
$.post("test.php", { name: "John", time: "2pm" } );
//Example: pass arrays of data to the server (while still ignoring the return results).
$.post("test.php", { 'choices[]': ["Jon", "Susan"] });
The first one passes an Object, doesn't it?
And the second is an array, right?
So, I imagine if test.php was:
your code is json, a string version of javascript objects. to me, a jQuery selection is a collection of DOM elements, which cannot be passed over http without converting to a string, such as html code.
Bookmarks