This question already has an answer here:
I am downloading data from JSON and I would like to mark each individual displayed record with a checkbox and send marked records by e-mail.
This is my piece of code displaying json:
$(document).ready(function(){
$("button").click(function(){
$.getJSON("data.json", function(result){
$.each(result, function(i, field){
$("div").append("" +field + "</br>");
});
});
});
});
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<button>Get JSON data</button>
<div></div>
</body>
</html>
data.json :
[
["AAA"],
["BBB"],
]
Is there anyone able to direct me how to assign JSON record to a checbox? Please, give me a hint what next.
Aucun commentaire:
Enregistrer un commentaire