Posted By

gaunab on 11/03/06


Tagged

ajax jquery


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

francisre
vali29
umang_nine
wirenaught


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


 / Published in: JavaScript
 

  1. var hash = new String();
  2.  
  3. $.each(elements, function(k) {
  4.  
  5. hash += this['id'] + 'weight: "' + k + '",\n';
  6. hash += this['id'] + 'children: "' + this['children'].toString() + '",\n';
  7.  
  8. });
  9.  
  10. "if I print hash I get:"
  11.  
  12. node1weight: "0",
  13. node1children: "node3,node4",
  14. node2weight: "1",
  15. node2children: "",
  16. node5weight: "2",
  17. node5children: "",
  18.  
  19.  
  20. "but the $_POST array in my php script is empty when using the following line:"
  21.  
  22. $("#field1").load("/nodes/sort", hash);

Report this snippet  

You need to login to post a comment.