Undefined(Error), I am trying to pass variable but it fails. I also tried deleteItem(echo $filename;)
Code
foreach(glob('download/*.*') as $filename) {
deleteItem($filename)
}
Update
<a  class="btn mini green-stripe" onclick="deleteItem(<?php $filename ?>)" href="#">Load Item</a> 
PHP Parse error:  syntax error, unexpected '$result1' (T_VARIABLE)
I'm trying to pass variable into the ajax
Ajax
function deleteItem(link){
//Load select Items 
alert(link);
$.ajax({
    type: "POST", 
    url: "funcAjax.php",
    data: {"error":"0","deleteItem":link},
    dataType: 'json', 
    success: function(data) {
    if (data.error != 0) {
        // An error occurred on server: do something 
    } else {
alert(data.result1);
    }
}
});
}
Any idea how i can pass the variable which is the file name? I'm trying to pass it in and delete the image based on the name of the file but i cant seem to pass it though a variable
 
    