When you click on the picture you need it to go away. I attach the code below. Tell me where the error is. When I click on the picture, the page hangs on me, through the debugger it doesn’t look everything hangs tight.
$mnogo = "SELECT * FROM images where tovars_id=$_REQUEST[id]"; $rows=$dbh->query($mnogo)->fetchAll(); <? foreach($rows as $k=>$img){ ?> <img id="output_<?=$k?>" data-id="<?=$img[id]?>" class="modal_images" style="height: 100px; width: 100px;" src="<?= $img['name'] ?>"> <?}?> <? if ($_POST[upload]) { $id = $_POST[id]; $uploaddir = '/i/'; file_put_contents($_SERVER["DOCUMENT_ROOT"]."/_.txt", "\n\r".__FILE__.":".__LINE__."\n\r".print_r($_FILES, true)); foreach($_FILES['userfile']['name']as $m = > $w) { if (($_FILES['userfile']['type'][$m] == 'image/gif' || $_FILES['userfile']['type'][$m] == 'image/jpeg' || $_FILES['userfile']['type'][$m] == 'image/png') && ($_FILES['userfile']['size'][$m] != 0 and $_FILES[ 'userfile']['size'][$m]<=1024000)) { $ex = explode('.', $w); $ex = end($ex); $apend = date('YmdHis').rand(100, 1000). '.'.$ex; $uploadfile = "$uploaddir$apend"; if (move_uploaded_file($_FILES['userfile']['tmp_name'][$m], $_SERVER[DOCUMENT_ROOT].$uploadfile)) { $c = "INSERT INTO images (name, tovars_id) VALUES('$uploadfile', '$id')"; $query = $dbh -> prepare($c); $query -> execute(); } } } header("Location: /pr1.php"); exit; } elseif($_POST[image_delete]) { $id = $_POST[image_id]; $src = $_POST[src]; $c = "DELETE FROM `images` WHERE id=$id"; //unlink($_SERVER[DOCUMENT_ROOT].$src); $query1 = $dbh -> prepare($c); $query1 -> execute(); } else { echo "Error2"; } ?> $(".modal_images").click(function() { id = this.dataset.id; src = this.attributes.src; //$.ajax("/exit.php", {image_id:id, src: src, image_delete: 'true'}/*, function (){$(this).fadeOut("slow")}*/); $.ajax({ type:"POST", url:"exit.php", data:{ image_id: id, src:src, image_delete:'true' }, success: function(msg) { alert(msg); } }); });
imagestable? - Alexey ShimanskySelectrequest ........... otherwise you are now trying to return to a telepathic debugging session .... - Alexey Shimansky