How do i get multiple sortable list data to php in wordpress?

How do i get multiple sortable list data to php in wordpress?

I have 2 lists, i am populating the first list with an array, and then dragging and dropping between the lists.
i need to get the data from those lists, after someone moves something between them. I think im on the right track, i have plugin.php, admin.js, and my-ajax.php
i need to somehow post data from admin.js to my-ajax.php

I have this CSS
  1. <style>
    #sortable3, #sortable4 {
          border: 1px solid #eee;
          width: 142px;
          min-height: 20px;
          list-style-type: none;
          margin: 0;
          padding: 5px 0 0 0;
          float: left;
          margin-right: 10px;
    }
    #sortable3 li, #sortable4 li {
          margin: 0 5px 5px 5px;
          padding: 5px;
          font-size: 1.2em;
          width: 120px;
    }
    </style>  
This is the relevant stuff from the plugin.php(i can post the whole thing if needed its just to make the lists)
  1. wp_register_script('admin-js', plugin_dir_url(__FILE__) . '/admin.js', array('jquery'), '', true);
  2. wp_localize_script( 'admin-js', 'dtAjax', array( 'ajaxurl' => plugins_url('my-ajax.php', __FILE__)));
  3. wp_enqueue_script('admin-js');
  4. wp_enqueue_script('jquery');
  5. wp_enqueue_script( 'jquery-ui-sortable' );
  6. register_setting( 'settings-group', 'filter_fields_order' );
  7. register_setting( 'settings-group', 'filter_fields_order2' );

  8. function plugin_options_page() {
  9. $fields_order_default = array(
  10. 0 => array(
  11. 'id' => '0',
  12. 'name' => 'List Item 1',
  13. 'slug' => 'list_item_1'
  14.                 ),
  15.                 1 => array(
  16.                     'id' => '1',
  17.                     'name' => 'List Item 2',
  18.                     'slug' => 'list_item_2'
  19.                 ),
  20.                 2 => array(
  21.                     'id' => '2',
  22.                     'name' => 'List Item 3',
  23.                     'slug' => 'list_item_3'
  24.                 ),
  25.      );
  26.         ?>
  27. <ul id="sortable3" class="filter-fields-list" >
  28.         <?php 
  29. foreach($filter_fields_order as $value) { ?>
  30.         <?php 
  31.         if(isset($value['id'])) { $id = $value['id']; }
  32.         if(isset($value['name'])) { $name = $value['name']; }
  33. if(isset($value['slug'])) { $slug = $value['slug']; }
  34.                 ?>
  35. <li class="sortable-item">
  36.                 <?php echo $name; ?>
  37.             <input type="hidden" name="filter_fields_order[<?php echo $id; ?>][id]"                               value="<?php echo $id; ?>" />
  38. <input type="hidden" name="filter_fields_order[<?php echo $id; ?>][name]"                               value="<?php echo $name; ?>" />
  39. <input type="hidden" name="filter_fields_order[<?php echo $id; ?>][slug]"                               value="<?php echo $slug; ?>" />
  40.             </li>
  41. <?php } ?>
  42.         </ul>
  43. <ul id="sortable4" class="filter-fields-list">
  44. <?php 
  45. foreach($filter_fields_order2 as $value) { ?>
  46.         <?php 
  47.         if(isset($value['id'])) { $id = $value['id']; }
  48.         if(isset($value['name'])) { $name = $value['name']; }
  49. if(isset($value['slug'])) { $slug = $value['slug']; }
  50.         ?>
  51. <li class="sortable-item">
  52.             <?php echo $name; ?>
  53. <input type="hidden" name="filter_fields_order2[<?php echo $id; ?>][id]"                               value="<?php echo $id; ?>" />
  54. <input type="hidden" name="filter_fields_order2[<?php echo $id; ?>][name]"                               value="<?php echo $name; ?>" />
  55. <input type="hidden" name="filter_fields_order2[<?php echo $id; ?>][slug]"                               value="<?php echo $slug; ?>" />
  56.             </li>
  57. <?php } ?>
  58.         </ul>
  59. <?php
  60. }

this is the jQuery admin.js
  1. jQuery(document).ready(function($){
  2. $(document).ready(function() {
  3. $('#sortable3, #sortable4').sortable({
  4.         connectWith: ".filter-fields-list",
  5.     stop: function (event, ui) {
  6.         var data = $(this).sortable('serialize');
  7.                   alert(data);
  8.         $.ajax({
  9.                   data: data,
  10.                   type: 'POST',
  11.                   url: dtAjax.ajaxurl,
  12.                       failure: function(data) {
  13.     alert("You suck");
  14.   },               
  15.                       success: function(data) {
  16.     alert("You Dont");
  17.   }
  18.         });
  19.     }
  20. }).disableSelection();
  21. });
  22. });
besides plugin.php and admin.js i have my-ajax.php,
  1. <?php
    return;