weixin_33717117 2019-03-03 20:51 采纳率: 0%
浏览 18

阵列中的图像未显示

In my website I use a javascript function to get images from a datasource. It is working when the content is hard coded as shown below: (the real path is replaced by xxxx for obvious reasons)

function showcampopicture(data){
    var mygallery=new fadeSlideShow({   
    wrapperid: "images", //ID of blank DIV on page to house Slideshow   
    dimensions: [450, 300], //
    imagearray:   [["https://xxxx/slikithumb/sliki/Schewnfeld.jpg"],
       ["https://xxxx/sliki/slikithumb/1/85_2018-11-13.jpg"], 
       ["https://xxxx/sliki/slikithumb/1/85_2018-11-12.jpg"], 
       ["https://xxxx/sliki/slikithumb/1/85_2018-10-28.jpg"]]
    displaymode: {type:'auto', pause:1000, cycles:0, wraparound:false},   
      persist: false, //
      fadeduration: 2000, //transition duration (milliseconds)  
      descreveal: "ondemand",
      togglerid: ""
      })    
    }

When I make a ajax request, I get the same content from:

$.ajax({
type: "POST",
url: "pictures_sql.php",

success: function(data){
     showcampopicture(data);
}
});

The problem is that my Cromebrowser cannot read the file paths and shows Content error:

[:1 GET https://xxxx/[ 404 (Not Found)
Image (async)
fadeSlideShow @ slide-show.js:1
showcampopicture @ campo_details.php:165
success @ campo_details.php:185
o @ 10b7194f44f2a10d55b4d05c5f6aacc2.js:3

h:1 GET https://xxxx/h 404 (Not Found)

Does anybody have a idea why the strange behaviour occurs? Thanks

More info: I have tried this: calling the function showcampopicture("https://xxxx.mypic.jpg") Gives the same result that the browser tries to chunk the string by every letter:
errror in Chrome: GET https://xxxx/s 404 (Not Found), GET https://xxxx/l 404 (Not Found)

-- So I have found the problem but not solved it. You need to pass an array. Quite simple but I just forgot that you have to convert the php data to a js array. I used json and it is working now.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 求指导ADS低噪放设计
    • ¥15 CARSIM前车变道设置
    • ¥50 三种调度算法报错 有实例
    • ¥15 关于#python#的问题,请各位专家解答!
    • ¥200 询问:python实现大地主题正反算的程序设计,有偿
    • ¥15 smptlib使用465端口发送邮件失败
    • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
    • ¥15 对于squad数据集的基于bert模型的微调
    • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
    • ¥20 steam下载游戏占用内存