我有一個由MYSQL的記錄集填充的動態表。 每一行都有它自己的刪除按鈕(圖片)來刪除特定的行。 這個按鈕有一個class =「button」。在php中使用jquery變量
我正在使用JQuery彈出窗口模式在單擊刪除按鈕時彈出一個窗口。 在這個JQuery腳本中,我創建了一個變量,它包含已被點擊的行的第一個td cel的數值。 這一切都完美。
我想完成的是在同一個php頁面上使用這個變量。 這裏是我的知識用完的地方。 我讀過一些例子,其中Ajax是解決方案,但我缺乏這方面的知識來使用這個解決方案。
jQuery代碼:
<script src="../javascript/jquery-1.8.2.js"></script>
<script src="../javascript/jquery.reveal.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.button').click(function(e) { // Button which will activate our modal
var value=$(this).closest('tr').children('td:first').text();
alert(value); // this works
$('#modal').reveal({ // The item which will be opened with reveal
animation: 'fade', // fade, fadeAndPop, none
animationspeed: 500, // how fast animtions are
closeonbackgroundclick: false, // if you click background will modal close?
dismissmodalclass: 'close' // the class of a button or element that will close an open modal
});
return false;
});
});
</script>
我一直在嘗試太多,我不看邏輯了。 我希望有人能幫助我。
你想用這個變量做什麼?需要在同一頁面中,還是將它傳遞給不同的PHP腳本? – MISJHA 2013-05-02 13:08:23
我需要這個變量,所以我可以在點擊彈出窗口中的yes按鈕時使用它。 Yes – 2013-05-02 13:11:16
單擊「是」按鈕時,您想如何使用它?你想把它發送到服務器? – eliah 2013-05-02 13:12:41