Skip to content Skip to sidebar Skip to footer

Writing Link Value From Json File

building an app with phonegap for android and reading content from local json file. but i can't add link my output. it works without link, but when i try to add link value, it does

Solution 1:

I've seen this work...

var link = $("<a href='" + value.link + "'></a>");
link.get(0).click();

Maybe you can do some variation on it with something you've already got.

"<lionclick='link.get(0).click();' />"+value.title+"</li>";

Just an idea.

Solution 2:

demoenter image description here

$(document).on("pagebeforeshow", "#page", function(){ 
  $.getJSON("res/veri/content.json", function(data){
    console.log(data);
    $.each(data, function (index, value) {
      $('#list').append('<li class="listElement" onclick="openLink('+value.link+')">'+value.title+'</li>'
      );
    });
  });
});

Solution 3:

'<li><ahref="' + value.link + '"data-rel="external">' + value.title + '</a></li>';

it work with this code.

Post a Comment for "Writing Link Value From Json File"