這是工作,並由於某種原因不會在ajax
輸出工作。jquery點擊不與阿賈克斯輸出工作
原始內容
<div id="selected_standards" class="touchcarousel black-and-white">
<ul id="standards_list" class="touchcarousel-container">
<?php
$sql = "SELECT * FROM standards
LEFT JOIN image
ON image.imageID = standards.imageID_standard
WHERE auditID_standard = '$audit_id'";
$result = mysqli_query($mysqli,$sql) or die(mysqli_error($mysqli));
while($row = mysqli_fetch_assoc($result)){
$standardImagePath = $row['imageLocation'];
list($width, $height) = getimagesize($standardImagePath);
//landscape
if($width > $height){
$img_width = '200';
$margin = '170px';
//portrait
}else if ($width < $height){
$img_width = '120';
$margin = '90px';
}
?>
<li class="touchcarousel-item">
<input type="hidden" class="image_id" value="<? echo $row['imageID']; ?>">
<input type="hidden" class="audit_id" value="<? echo $audit_id; ?>">
<input type="button" class="del_standard_cross" name="del_standard" value="" style="margin-left:<? echo $margin; ?> !important;">
<img src="<? echo $row['imageLocation']; ?>" width="<? echo $img_width; ?>" >
</li>
<?php } ?>
</ul>
</div>
的php
爲ajax
響應
$output .='<ul id="standards_list" class="touchcarousel-container">';
$path = "upload/".$id."/standards/";
while($row = mysqli_fetch_assoc($result)){
$standardImagePath = '../'.$row['imageLocation'];
list($width, $height) = getimagesize($standardImagePath);
//landscape
if($width > $height){
$img_width = '200';
$margin = '170px';
//portrait
}else if ($width < $height){
$img_width = '120';
$margin = '90px';
}
$output .='<li class="touchcarousel-item">';
$output .='<input type="hidden" class="image_id" value="'.$row['imageID'].'">';
$output .='<input type="hidden" class="audit_id" value="'.$audit_id.'">';
$output .='<input type="button" class="del_standard_cross"
name="del_standard" value="" style="margin-left:'.$margin.' !important;">';
$output .='<img src="'.$row['imageLocation'].'" width="'.$img_width.'" >';
$output .='</li>';
}
$output .='</ul>';
的jquery
不上ajax
輸出
$(document).ready(function() {
$('.touchcarousel-item').on('click', '.del_standard_cross', function(e){
alert('smeg');
});
});
我看到了,但不明白它是如何與我的代碼,但由於答案的交代我現在知道你爲什麼 – tatty27