在jQuery图像列表视图中查看图像

问题描述:

为什么在iOS模拟器的jQuery Mobile图像列表视图中不显示某些图片?在jQuery图像列表视图中查看图像

而不是图像,它显示一个带有问号的蓝色框。如果出现网址问题,那么所有图片肯定会显示带有问号的图标,但有些图片显示完美无瑕。

我将图像大小调整为较小的大小,但没有解决问题。我该如何解决这个问题?

这是从mysql数据库获取图像的javascript。所有图像都在后端根文件夹中。

.$(function() { 
     var serviceUrl = 'http://localhost/Backend/getDinner.php?jsoncallback=?'; 
     var dataStore = {}; 
     $.ajax({ 
        url: serviceUrl, 
        crossDomain: true, 
        dataType: "jsonp", 
        contentType: "application/json; charset=utf-8", 
        jsonpCallback:'jsoncallback', 
       }) 
      .success(function(data) { 
      $.each(data, function(i, item){ 
      // Stash the items by id for later retrieval.   
      dataStore[item.ID] = item; 
      var $row = $(
      '<li>' + 
      '<a data-transition="slide" href="#detailsPage">' + 
      '<img src="' + item.ImageURL + ' ">' + 
      '<h2>' + item.Title + '</h2>' + 
      '<h2>' + 'Price :'+ item.Price + '</h2>' + 
      '</a>' + '</li>'); 
      $('#output').append($row); 

这里是获取列表视图的HTML。

<div data-role="content" data-scroll="true" > 
    <ul id="output" data-role="listview" ></ul> 

以下是IOS屏幕截图。

+0

一些代码请。 – Omar 2013-04-04 12:44:46

+0

你可以在这里发布Item.ImageURL的值吗? – 2013-04-04 13:40:23

+0

你的意思是“ImageURL”:“images \/dinner \ /breakfast5.jpg”, – 2013-04-04 13:46:28

,我已经看到了这个唯一的一次,当图像名称不正确输入或文件的位置是不正确的。

例如:正确的文件名“images/myimage.png”错误地输入为“images/myimge.png”,或者URL或文件位置不正确。

您可能需要重新检查您的URL位置和文件名是否输入正确,没有错误。