I have this code HTML
to consume JSON
by ajax
, but it does not show me the data I want to bring.
Can you tell me what I'm doing wrong?
The url
of JSON
is this: link *
This is the script
that this is using:
<div class="panel-heading">Programa</div>
<div class="panel-body" id="programas"></div>
<script type="text/javascript">
$(function ()
{
$.ajax({
url: 'http://www.mocky.io/v2/5a5502052d0000f43a5b1e60',
type: 'GET',
dataType: 'JSON',
success: function (data)
{
var program = "<ul>";
for (var c = 0; c < data.length; c++) {
var infoprograma = "<li>" + "Programa: "+ data[c].programa[0].programa;
infoprograma += "Sinopsis: " + data[c].programa[0].sinopsis;
infoprograma += "Conductor: " + data[c].programa[0].conductor;
infoprograma += "Clasificacion: " + data[c].programa[0].clasificacion;
infoprograma += " <em>" + data[c].programa[0].tipoProgram + "</em> </li>";
program += infoprograma;
}
program += "</ul>";
$("#programas").html(infoprograma);
}
})
});
</script>
When I give Network > Preview
it shows me the object I'm calling, but in the div
it does not show me anything.