Return to Snippet

Revision: 1657
at November 3, 2006 08:32 by gaunab


Updated Code
var hash = new String();

    $.each(elements, function(k) {

        hash += this['id'] + 'weight: "' + k + '",\n';
        hash += this['id'] + 'children: "' + this['children'].toString() + '",\n';

    });

"if I print hash I get:"

node1weight: "0",
node1children: "node3,node4",
node2weight: "1",
node2children: "",
node5weight: "2",
node5children: "",


"but the $_POST array in my php script is empty when using the following line:"

$("#field1").load("/nodes/sort", hash);

Revision: 1656
at November 3, 2006 08:31 by gaunab


Initial Code
var hash = new String();

    $.each(elements, function(k) {

        hash += this['id'] + 'weight: "' + k + '",\n';
        hash += this['id'] + 'children: "' + this['children'].toString() + '",\n';

    });

if I print hash I get:

node1weight: "0",
node1children: "node3,node4",
node2weight: "1",
node2children: "",
node5weight: "2",
node5children: "",

but I don't have anything in the $_POST array in my php script when using the following line:

$("#field1").load("/nodes/sort", hash);

Initial URL


Initial Description


Initial Title
jQuery/Ajax - How to generate a valid POST hash?

Initial Tags
ajax, jquery

Initial Language
JavaScript