i have table like image bellow where i create from query to databases, each row have button when onclick will be prompt dialog box (i use jquery dialog widget)
this myform html code
<form action="prodi_tampil_mhs.php" method="post" name="form_tambah_cl_wisudawan" id="form_tambah_cl_wisudawan">
this my php code where i create the table from query database
while ($fetch_dbsi_mhsw=mysql_fetch_array($query_dbsi_mhsw)) {
$no++;
echo" <tr>
<td>$no</td>
<td>$fetch_dbsi_mhsw[NIM]</td>
<td>$fetch_dbsi_mhsw[Name]</td>
<td style=\"text-align: center;\"><input name=\"bt_tambah_calon_wisudawan\" id=\"bt_tambah_calon_wisudawan\" type=\"image\" src=\"buttonTambah.png\" alt=\"Tambah\" align=\"middle\" width=\"20\" height=\"20\" class=\"bt_tambah_calon_wisudawan\" /></td></tr>";}
and my jquery code
$(document).ready(function(){
$(".bt_tambah_calon_wisudawan").click(function(){
var value1 = $(this).closest('tr').find('td:eq(1)').text();
var value2 = $(this).closest('tr').find('td:eq(2)').text();
// Here's the text of the dialog box
var dialog = $("<div style='display: none'><p>Anda akan menambahkan "+value1 + " " + value2 + " sebagai calon wisudawan?</p></div>").appendTo("body");
// This is the button on the form
var form = $("#form_tambah_cl_wisudawan")
// The form button was pressed - open the dialog
$(dialog).dialog({
title: "Konvirmasi Penambahan Data",
dialogClass: "no-close",
width: 600,
modal: true,
buttons: {
"Tambah": function () {
// This will invoke the form's action - putatively deleting the resources on the server
$(form).submit();
$(this).dialog("close");
},
"Cancel": function() {
// Don't invoke the action, just close the dialog
$(this).dialog("close");
}
}
});
return false;
});
});
my dialog box appear (like image 2)
when i click button "tambah" in dialog box my value in form not passing. any mistake in my jquery code? any help?