I have this Javascript in a ASP.Net MVC page
onComplete: function (id, fileName, responseJSON) {
if (responseJSON.success) {
$('#divImgs ul').append(
$('<li>').append(
$('<a>').attr('href',
'@Url.Action("DeleteFile", "Upload", new { id = fileName})').append(
$('<img>').attr('src', responseJSON.filePath))
));
}
}
This gives Compilation error
The name 'fileName' does not exist in the current context
Why can't I access fileName variable within the @Url.Action?