Worklight和jquery:我想要在xml中提供获取链接并想要动态地标记它们吗? [英] Worklight and jquery: I want fetch links present in the xml and want tag them with the row dynamically?

查看:68
本文介绍了Worklight和jquery:我想要在xml中提供获取链接并想要动态地标记它们吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上面附着了我的图片,它取出了远程服务器,在内容页面中显示为行。
我在同一个xml中有链接,我想标记该行的链接并点击该用户应该加载的页面。

Above attached my image that fetched it remote server its shown as row in the contents page. I have link in the same xml, i want to tag that link to this row and clicking it user should take should be loaded with page.

怎么能我拿到了吗?

function displayFeeds(items){
    var ul = $('#itemsList');
    for (var i = 0; i < items.length; i++) {
        var li = $('<li/>').html(items[i].title);

        var l = $('<li/>').html(items[i].link);

        ul.append(li);

    }

这是我获取xml内容的方法。我也在提取链接,但不知道如何将其链接到该行。

This is how I fetch the contents of the xml. I am also fetching the link but do not know how link it to the that row.

请帮助..
问候,
Sandy

Please help.. Regards, Sandy

推荐答案

你需要一个锚标签,或者你需要绑定到li的点击事件。

You either need an anchor tag or you need to bind to the li's click event.

var lineItems;

lineItems = $(items).map(function(){
  var item = $(this);
  return '<li><a href="'+item.link+'">'+item.title+'</a></li>'
}).get().join();

ul.append(lineItems);

这篇关于Worklight和jquery:我想要在xml中提供获取链接并想要动态地标记它们吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆