javascript - Onclick list-item, display new data -
i making script wil this:
this demo: demo
the list in first page generated javascript , displays list-items. works fine , displays list-items category == category.
$( document ).ready(function() { var data = [{ "name": "lichtbediening", "category": "category", "info": "klik voor lichtbediening", "img": "lichtbediening" }, { "name": "stopcontact", "category": "category", "info": "klik voor stopcontacten", "img": "stopcontacten" }, { "category": "lichtbediening", "name": "enkele schakelaar", "info": "een knop, een lamp", "img": "rolluikbediening" }, { "category": "stopcontact", "name": "enkel stopcontact", "info": "twee knoppen, twee lampen", "img": "multimedia" }]; var output = ''; $.each(data, function (index, value) { if(value.category != 'category') { return; } else { output += '<li><a href="#">' output += '<img src="img/' + value.img + '.jpg">' output += '<h2>' + value.name +'</h2>' output += '<p>' + value.info + '</p>' output += '</a></li>'; } }); $('#list_zoek_category').html(output).listview("refresh"); });
now want display new list when 1 list-item clicked. first want generate new list wich displays list-items category same name of item clicked. example: when click on list-item name: lichtbediening" in first list, new list displays list-items category: "lichtbediening".
what best way this? better re-generate current list, or go new page? keep in mind, when click on item in second list, want go detail page. want create backbutton display previous view.
can give me advise, , maybe start direction?
Comments
Post a Comment