I want to delete a record by passing dynamic value generated in while loop to ajax. I want to pass $ef value in jquery. (i.e)Delete sample hrms trail.doc file in onclick event of delete image. now onclick event of image tag doesn't show any action
while($fet=mysql_fetch_assoc($sql1))
{
$file=$fet['f_name'];
$ef=$fet['ef_id'];
$next1 = basename($file);
echo "<h3><a class=doc href='".$file."' title='".$file."' download><p style='margin-left:1cm;'>".$next1."</a>";
echo '<img src="image/delete1.png" id=".$ef."width="10" height="10" title="Remove" onclick="javascript:myFunction();">';
}
My jquery ajax code
<script>
function myFunction()
{
var rmvfile=$("doc").val();
$.ajax({
type:'post',
url:'hrms/delete_emp_file.php',
data:{rmvfile: rmvfile},
success:function(msg){
if (msg.length> 0) {
alert(msg);
} }
});
}

php code in delete_emp_file.php
$s=$_POST['rmvfile'];
include "config.php";
$echeck="delete from employee_file where ef_id='".$_POST['rmvfile']."'";
$echk=mysql_query($echeck);
$ecount=mysql_num_rows($echk);
if($ecount>='1')
{
echo "file deleted";
}
echo "<h3><a **class=doc** href='".$file."' title='".$file."' download><p style='margin-left:1cm;'>".$next1."</a>";var rmvfile=$("doc").val();this should bevar rmvfile=$(".doc").val();