On 11/29/06, staer <[EMAIL PROTECTED]> wrote:

function serialize(id){
serial= $.SortSerialize();
myserial= serial.hash;
mypage= "message.php?name=&message="+myserial;
$("#feeds").load(mypage);
};


mypage looks like this:

message.php
?name=&message=sort_me[]=item9&sort_me[]=item10&sort_me[]=item11&sort_me[]=item12

A quick var_dump($_GET) shows this:

*array*
 'name' => '' *(length=0)*
 'message' => 'sort_me[]=item9' *(length=15)*
 'sort_me' =>
   *array*
     0 => 'item10' *(length=6)*
     1 => 'item11' *(length=6)*
     2 => 'item12' *(length=6)*

which means that part of myserial is going into $_GET['message'] and the
rest of it is going into $_GET['sort_me'].

If you chop of "message=" from mypage you get this:

message.php
?name=&sort_me[]=item9&sort_me[]=item10&sort_me[]=item11&sort_me[]=item12

and another quick var_dump($_GET) shows:

*array*
 'name' => '' *(length=0)*
 'sort_me' =>
   *array*
     0 => 'item9' *(length=5)*
     1 => 'item10' *(length=6)*
     2 => 'item11' *(length=6)*
     3 => 'item12' *(length=6)*

now all of myserial is going into $_GET['sort_me'] which is exactly what we
want.

So the final serialize() looks like this:

function serialize(id){
// I'm guessing you only want to serialize id, and not every sortable on the
page at once
var serial= $.SortSerialize(id);
var myserial= serial.hash;
// Give PHP id and myserial
var mypage= "message.php?name="+id+"&"+myserial;
$("#feeds").load(mypage);
};

and the PHP looks something like this:

<?php
   $name = $_GET['name']; // $name = 'sort_me'
   $hash = $_GET[$name];
   // $hash = array('item9', 'item10', 'item11', 'item12')

   foreach($hash as $item) {
       // do something
   }
?>

--
Aaron Heimlich
Web Developer
[EMAIL PROTECTED]
http://aheimlich.freepgs.com
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to