I have json file that I use like a simple database kind of system.
jsondata = {
"project1":
{"titel":"letterfabriek", "omschrijving":"Doe", "linktext":"http://www.website.nl", "img":"ding.png"},
"project2":
{"titel":"John", "omschrijving":"Doe", "linktext":"http://www.website.nl", "img":"ding.png"}
}
When someone click on a button I want that project to be selected out of the json file.
So for instance
<li class="portfolio" data-titel="project1"><img src="img/portfolio/1.png"></li>
On the hit I get the project titel like :
project = $(this).attr("data-titel");
Now as last I want this title displayed in a div with the class titel
I know this will work:
$(".titel").text(jsondata.project1.titel);
$(".description").text(jsondata.project1.omschrijving);
But instead I want the project title be the var project. So something like
jsondata. + var project + .titel etc..
How can I do this?
Thanks in advance