データベースから行を削除する単純なjquery関数を取得しました。私のスクリプトは次のとおりです。
///
// delete the entry once we have confirmed that it should be deleted $('.delete').click(function() { var parent = $(this).closest('tr'); $.ajax({ type: 'get', url: 'delete.php', // <- replace this with your url here data: 'ajax=1&delete=' + $(this).attr('id'), beforeSend: function() { parent.animate({'backgroundColor':'#fb6c6c'},300); }, success: function() { parent.fadeOut(300,function() { parent.remove(); }); } }); }); // confirm that it should be deleted $('.delete').confirm({ msg:'Do you really want to delete this?', timeout:3000 }); }); // ]]></script>
bitton dalete の行 (画面上) をクリックすると、データベースにまだ存在します。php が実行されているかどうかを確認するにはどうすればよいですか? 私のphpファイル:
> <?php $con = mysql_connect("localhost","root",""); if (!$con) {
> die('Could not connect: ' . mysql_error()); }
>
> mysql_select_db("xxx", $con);
> $sql="DELETE FROM
> `submission_values` WHERE SubmissionId =49";
> mysql_query($sql,$con);
>
> ?>
同じフォルダにある場合、どの URL を指定すればよいですか? 上記のような名前だけですか?それはうまくいくはずですか?(delete.php 内)
echo("alert('ok');");