I am trying to print a json format data in HTML page. No matter what I do, I can't print the data in the html page. Here is my code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$.getJSON("https://indian-courier-api-premium.vercel.app/api/delhivery/2535101029260?format=jsonp&lang=en&?callback=?", function(result){
$.each(result, function(i, field){
$("div").append(field + " ");
});
});
});
});
</script>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<button>Get JSON data</button>
<div></div>
</body>
</html>