下面的代码给了我一个未终止的字符串文字错误,如何解决?
下面是javascript代码(QandAtable.php)。
$(".imageCancel").on("click", function(event) {
var image_file_name = "<?php echo str_replace("\n", "", $image_file_name); ?>";
$('.upload_target').get(0).contentwindow
$("iframe[name='upload_target']").attr("src", "javascript:'<html></html>'");
jQuery.ajax("cancelimage.php" + image_file_name)
.done(function(data) {
$(".imagemsg" + _cancelimagecounter).html(data);
});
return stopImageUpload();
});
下面是 ajax 链接到的 imagecancel.php 脚本:
...
$image_file_name = $_GET["fileImage"]["name"];
echo "File Upload was Canceled";
$imagecancelsql = "DELETE FROM Image
WHERE ImageFile = 'ImageFiles/". mysql_real_escape_string($image_file_name)."'";
mysql_query($imagecancelsql);
在错误控制台中,它显示为:var image_file_name = "<br />