Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无法将小图像传递到模式弹出窗口并显示它_Javascript_Jquery_Jquery Ui - Fatal编程技术网

Javascript 无法将小图像传递到模式弹出窗口并显示它

Javascript 无法将小图像传递到模式弹出窗口并显示它,javascript,jquery,jquery-ui,Javascript,Jquery,Jquery Ui,我正在创建页面加载的图像元素,并用AJAX POST jquery方法为其编写代码。所以页面上出现了一些小图标。当我点击document.ready(onclick)上的图像时,它必须在模式弹出窗口中打开,但它没有打开。但是空白弹出窗口正在打开 loadup.js代码 $.ajax({ type: "POST", url: "php/loadimages_f.php", dataType : 'json', success: function (result)

我正在创建页面加载的图像元素,并用AJAX POST jquery方法为其编写代码。所以页面上出现了一些小图标。当我点击document.ready(onclick)上的图像时,它必须在模式弹出窗口中打开,但它没有打开。但是空白弹出窗口正在打开

loadup.js代码

$.ajax({
    type: "POST",
    url: "php/loadimages_f.php",
     dataType : 'json',
    success: function (result) {
        //alert(result);
         if(result==0){
       $("#friends_list_insert").after(" No Friends Yet...");
   }
    else{   
    for(var i = 0; i < result.length; i++)
        {
             var PP_PATH;
            PP_PATH="php/"+result[i].Photo_URL;
          var li_post="<li class='imggalli' style='list-style:none;'><a 
    href='#' data-toggle='modal' data-target='#myModal2' class='thumbnailimg' title='Image"+i+"'><img src='"+PP_PATH+"' style='margin:2px;width:65px;height:65px;' class='img-responsive' id='img"+i+"'></a></li>";

          $("#img_gallery_append").append(li_post);
    }
   }
 }
});
   // Function for image pop up
     $(document).ready(function() {
       $('img').on('click', function() {
         $("#showImg").empty();
          // alert(this.id);
         var image = $(this).attr("src");
         $("#showImg").append("<img class='img-responsive' src='" + image + "' />")
     })
  });
$.ajax({
类型:“POST”,
url:“php/loadimages\u f.php”,
数据类型:“json”,
成功:功能(结果){
//警报(结果);
如果(结果==0){
$(“#朋友列表_插入”)。在(“还没有朋友…”)之后;
}
否则{
对于(变量i=0;i
   // Function for image pop up
     $(document).ready(function() {
       $('img').on('click', function() {
         $("#showImg").empty();
          // alert(this.id);
         var image = $(this).attr("src");
         $("#showImg").append("<img class='img-responsive' src='" + image + "' />")
     })
  });
//用于图像弹出的函数
$(文档).ready(函数(){
$('img')。在('click',function()上{
$(“#showImg”).empty();
//警报(this.id);
var image=$(this.attr(“src”);
$(“#showImg”)。追加(“”)
})
});

有什么问题?有人能帮忙吗?(目标是打开模式弹出窗口上的小图像。)

尝试更正此问题

PP_PATH="php/"+result[i].Photo_URL;


因为
result
是object,您需要用
d

捕捉数据,此时,我将第I个位置值附加到图像的src中,它将正确填充所有图像。但问题是在这之后。它是可点击的,但在模式弹出的空白即将到来。然而,我尝试了你的建议,但没有效果,请帮助