html page
<!DOCTYPE html>
<html lang="en">
<head>
<title>studentDetails</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h3>List Of Students</h3>
<div id="students">
<ul id="list" class="list-group">
</ul>
</div>
</div>
<script type = "text/javascript" src = "https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script type = "text/javascript" src = "app.js"></script>
</body>
</html>
app.js
$.getJSON('data.JSON',function(data){
for(var i = 0; i < data['students'].length; i++){
$('#students').append('<li id="' + data['students'][i]['id'] + '"' + 'class="list-group-item"> <a href="details.html">' + data['students'][i]['name'] + " "+ data['students'][i]['surname'] +'</a></li>' );
}
});
data.json
{"students":[
{
"id":"1",
"name":"Aaa",
"surname":"Bbb",
"standard":"7",
"age":"10"
},
{
"id":"2",
"name":"ABc",
"surname":"Pqr",
"standard":"7",
"age":"10"
}
]}
I am trying to pass data which is selected from a listview
to another page.
In the first HTML page there is a list of students' names which I had retrieved from JSON.
When a particular student is selected from the listview
its corresponding details should be displayed on the next page.