我有一個php頁面,它顯示來自多個MySQL查詢的表格,並從它們使用JavaScript函數對列結果進行排序,所有工作正常,我的問題是我需要刷新結果這些查詢每隔10秒左右工作正常(使用元刷新),問題是在列排序後進行刷新。當頁面刷新排序也被重置。這裏是一個排序功能的片段;
<script>
function tablesort(which){ <-----I tried using the $_GET method you suggested
<-----But i get a "missing formal parameter" error
<-----When also using this suggestion and use the
<-----"onclick" i get a "tablesort" is not defined
<-----error
$(document).ready(function(){
if(which == '1.0'){<!--This sorts the pause row, descending -->
$("#Mtable").tablesorter({sortList: [[1,0]]});
}
if(which == '2.1'){<!--This sorts the total dialer row, descending -->
$("#Mtable").tablesorter({sortList: [[2,1]]});
}
if(which == '3.0'){<!--This sorts Wrap-up time row, descending -->
$("#Mtable").tablesorter({sortList: [[3,0]]});
}
if(which == '4.1'){<!--This sorts donation amount row, descending -->
$("#Mtable").tablesorter({sortList: [[4,1]]});
}
if(which == '5.1'){<!--This sorts Up-sale row, descending -->
$("#Mtable").tablesorter({sortList: [[5,1]]});
}
if(which == '6.1'){<!--This sorts the Monthl donation row, descending -->
$("#Mtable").tablesorter({sortList: [[6,1]]});
}
if(which == '7.1'){<!--This sorts the verified sales row, descending -->
$("#Mtable").tablesorter({sortList: [[7,1]]});
}
if(which == '8.1'){<!--This sorts the calles per hour row, descending -->
$("#Mtable").tablesorter({sortList: [[8,1]]});
}
if(which == '9.1'){<!--This sorts the payments per hour row, descending -->
$("#Mtable").tablesorter({sortList: [[9,1]]});
}
if(which == '10.1'){<!--This sorts the average sale row, descending -->
$("#Mtable").tablesorter({sortList: [[10,1]]});
}
if(which == '11.1'){<!--This sorts the sales total row, descending -->
$("#Mtable").tablesorter({sortList: [[11,1]]});
}
});
}
</script>
這裏有那種因爲刷新IM想從onlcick傳遞變量數據類似於_GET $因此它的URL的表」
Sort by:
<a onclick="tablesort('1.0')"> Lowest Pause<a/>   
<a onclick="tablesort('2.1')"> Highest Dialer<a/>   
<a onclick="tablesort('3.0')"> Best Wrap-up<a/>   
的鏈接會像然後讀入排序功能;
本地主機/ dbtabke.php?它= 2.1 < ----使用完全相同的網址例如
如何做到這一點任何幫助將不勝感激,謝謝提前。
@prabeen義理我所提供的完整功能,再次感謝
'$獲得(的 'localhost/dbtabke.php?Mtable =' + sort_by_var,...)'? – 2013-04-10 15:38:27
您希望傳遞查詢變量作爲通過PHP頁面重新載入數據的AJAX請求的一部分。 – 2013-04-10 15:36:42
@Mathew Darnell,我想通過URL將「」tablesort('1.0')「數據傳遞給javascript函數,因爲它的刷新部分 – Iz3k34l 2013-04-10 15:39:07