Filipe Machado Carneiro Filipe Machado Carneiro - 3 months ago 24
Javascript Question

Trying to parse a json with several arrays inside

This is my Index.html

<div id="#here">


<script type="text/javascript">
$( document ).ready(function() {

$.getJSON("", function(data){
var x = data.asks
$.each(x, function(index, item) {
$('#here').append("<p>"+ item +"</p>");

i'm just trying to parse a json an put inside a

in the console the script runs ok


help guys, pleas


item is an array so you need to access the array element using brackets notation like so:


You also want to remove the # symbol from the id attribute of your div element. The id attribute value must begin with a letter.

So this should work.


<div id="here"></div>


$( document ).ready(function() {

  $.getJSON("", function(data) {
  var x = data.asks;

  $.each(x, function(index, item) {

    var $paragraph = $('<p>');