jQuery/ajax にやられています。
jQuery sortableを使用して呼び出されたphpスクリプトで計算された値で、ページ上の複数のテーブル行を更新しようとしています。
1行を簡単に更新できます。ajax スクリプトの結果を配列に追加して送り返し、行を並べ替えて更新する方法がわかりません。
これが私のJavaScriptです:
<script>
$(function() {                                                           
    $( "#sort tbody" ).sortable({ 
        update : function () { 
            var order = $('#sort tbody').sortable('serialize'); 
            $("#subtotal").load("ajax_update_line_order.php?"+order); 
        },
        placeholder: "ui-state-highlight" 
    }); 
    $( "#sort tbody" ).disableSelection();
});
</script>
html は単純なテーブルです。それぞれに一意のIDまたはクラス(どちらかはわかりません)、たとえばrow0、row1、row2など、位置に対応する番号を与えることができます。
ここに私の ajax_update_line_order.php があります:
<?php
........ 
foreach ($_GET['listItem'] as $position => $item)
{
   //Update position in mysql DB here (all ok)
   //Calculations here (all ok)
   //Add calculated result and position to an array
   $array[] = $calculation; (the array key will match the position here, so guess I can use this to reference when updating the table rows)
}
print_r($array); //Not sure how to get this array back to read and update the page
exit();
?>
どんな助けでも大歓迎です。
前もって感謝します。