Javascript 我想使用jquery从我的视图页面和表中删除图像

Javascript 我想使用jquery从我的视图页面和表中删除图像,javascript,jquery,mysql,codeigniter,Javascript,Jquery,Mysql,Codeigniter,这是我的查看页面。。。 此处我的图像未被删除。当我发出警报且未被删除时,图像名称未发出警报 <div class="modal fade" id="confirm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="mod

这是我的查看页面。。。 此处我的图像未被删除。当我发出警报且未被删除时,图像名称未发出警报

 <div class="modal fade" id="confirm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
              <div class="modal-dialog">
                <div class="modal-content">
                  <div class="modal-body">
                   Are you sure you want to delete this image? 
                  </div>

                  <div class="modal-footer">

                    <input type="hidden" name="image" id="img">
                    <button type="button" class="btn btn-default" data-dismiss="modal" id="modal-close">Close</button>
                    <button type="button" class="btn btn-danger" id="delete-ok">Ok</button>
                  </div>
                </div>
              </div>
            </div>


<script type="text/javascript">
    $(document).ready(function (){
    $('#modal-close').click();
       $("#file").change(function() { $('#upload-image').submit(); });
        $('#upload-image').on('submit',(function(e){
           e.preventDefault();
           //alert()
            var formData = new FormData(this);
            $.ajax({
                type:'POST',
                url: $(this).attr('action'),
                data:formData,
                cache:false,
                contentType: false,
                processData: false,
                success:function(result)
                {
                   //$('#uploaded-img').html(result);
                    //location.reload();
                }
            });
        }));

        $(".fa-close").click(function(){
            var image=$(this).attr('image');
           alert(image);
           $("#img").val(image);
        });

      $("#delete-ok").click(function(){
            var image=$("#img").val();
            alert(image);

            var url='<?php echo base_url(); ?>admin_control/delete_upload_image';
            alert(url);
            var id=$("#product_id").val();
            alert(id);

            $.post(url, {image:image,id:id}, function(result)
                  {
                    //$('#uploaded-img').html(result);
                    location.reload();

                  });


        });

      });
}


此处我的图像未被删除。当我发出警报且未被删除时,图像名称未发出警报。

我被困在此处…您对此进行了调试吗?我的意思是,如果你发布删除上传图片(),你的控制器在做什么?我清除了它…谢谢
 <div class="modal fade" id="confirm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
              <div class="modal-dialog">
                <div class="modal-content">
                  <div class="modal-body">
                   Are you sure you want to delete this image? 
                  </div>

                  <div class="modal-footer">

                    <input type="hidden" name="image" id="img">
                    <button type="button" class="btn btn-default" data-dismiss="modal" id="modal-close">Close</button>
                    <button type="button" class="btn btn-danger" id="delete-ok">Ok</button>
                  </div>
                </div>
              </div>
            </div>


<script type="text/javascript">
    $(document).ready(function (){
    $('#modal-close').click();
       $("#file").change(function() { $('#upload-image').submit(); });
        $('#upload-image').on('submit',(function(e){
           e.preventDefault();
           //alert()
            var formData = new FormData(this);
            $.ajax({
                type:'POST',
                url: $(this).attr('action'),
                data:formData,
                cache:false,
                contentType: false,
                processData: false,
                success:function(result)
                {
                   //$('#uploaded-img').html(result);
                    //location.reload();
                }
            });
        }));

        $(".fa-close").click(function(){
            var image=$(this).attr('image');
           alert(image);
           $("#img").val(image);
        });

      $("#delete-ok").click(function(){
            var image=$("#img").val();
            alert(image);

            var url='<?php echo base_url(); ?>admin_control/delete_upload_image';
            alert(url);
            var id=$("#product_id").val();
            alert(id);

            $.post(url, {image:image,id:id}, function(result)
                  {
                    //$('#uploaded-img').html(result);
                    location.reload();

                  });


        });

      });
 public function edit_image_delete($image)
  {


  if(file_exists('images/'.$image))
  {
    @unlink("./images/".$image);
  }
  if(file_exists('images/thumb/'.$image))
  {
    @unlink("./images/thumb/".$image);
  }
  return true;  
}