javascript - 如何在 jQuery mobile 中显示 XML 中的图像?

标签 javascript jquery xml ajax jquery-mobile

我觉得这有一个非常简单的解决方案,但我现在试图让它工作的时间可能太长了。

我已经创建了一个渲染图像的函数,至少这是它应该做的,但它没有。

function renderAD(entries) {
    var o = '';
    $.each(entries, function(i, v) {
        o +="<img src=" +v.image +"/>";
    });
    $("#adplace").html(o);    
}

我检查了 v.image 引用 http://allroundcars.nl/logo-ijsselmondenieuws.png ,这是我要加载的图像。但我看到的只是一个'?'图片(未找到图片)。

我做错了什么?感谢任何帮助,

谢谢

最佳答案

尝试将每个替换为:

$(entries).each(function(i, v) {
    o +='<img src="' + v.image + '"/>';
});

更新:添加 <a>周围:

o +='<a href="' + v.link + '"><img src="' + v.image + '"/></a>';

关于javascript - 如何在 jQuery mobile 中显示 XML 中的图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11622444/

相关文章:

javascript - GAS 中的 Access-Control-Allow-Origin header

javascript - Kendo Grid 设置屏幕大小调整时的最小列宽

jquery - 向 jQuery 添加事件

javascript - Access-Control-Allow-Origin 和 CORS 背后的概念是什么?

javascript - 如何简化或合并 2 个 jquery pullout 函数

javascript - 刷新wheelnav.js中的项目

c++ - rapidxml 在 wchar_t 内容上抛出异常

android - 为什么安卓:showAsAction doesnt work and app:showAsAction does?

java - 从包 swing 导入 xml 文件

php - 正则表达式:如何验证路径不包含//