I want to pass id value to ajax.rmvfile value echoed in this psge.I cant pass this to delete_emp_file.php page.
echo '<img src="image/delete1.png" id=".$ef." width="10" height="10" title="Remove" onclick="javascript:myFunction('.$fet['ef_id'].');">';
my script code
<script>
function myFunction(id)
{
alert(id);
var rmvfile=id;
//alert(rmvfile);
$.ajax({
type:'post',
url:'hrms/delete_emp_file.php',
data:{rmvfile: rmvfile},
success:function(msg){
if (msg.length> 0) {
alert(msg);
}
}
});
}
</script>
delete_emp_file.php
echo $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";
}