Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

124
Vistas
Extract JSON response from jquery ajax to html div

I could not retrieve data to jquery div element but i can see ajax response in firebug.

$(document).ready(function () {
    $.ajax({
        url: "https://m.lowes.com/CatalogServices/product/nvalue/v1_0?nValue=4294857975&maxResults=6&showURL=1&rollUpVariants=1&showUrl=true&storeNumber=0595&priceFlag=rangeBalance&showMarketingBullets=1&callback",
        dataType: "jsonp",
        success: function (data) {
            var returnedData = JSON.parse(data);
            $('#result').html(returnedData);
        }
    });
})

this is my response.for example my url contains data productCount:64 ,I should extract productCount from ajax success and display it in html div id result

about 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

When you parse out the JSOn data you use it like so:

var parsed_data = JSON.parse(JSON_DATA);
$('#result').html(parsed_data.key);

So if your parsed_data is somewhat like:

{name:"test",age:12}

then you use it like:

$('#result').html(parsed_data.name); //it will give you test

if you really want to print out the whole data use JSON.stringify(obj) like so:

$('#result').html(JSON.stringify(parsed_data));
about 4 years ago · Santiago Trujillo Denunciar

0

In your code you are returning a json and you are trying to insert ino the div it, into the div you can only insert html code instead json.

Try to inspect the json you are returning and in case you need to insert each element into the div, do it, but don't do for all.

The html() method doesn't know what you want to assign, it only insert an html.

about 4 years ago · Santiago Trujillo Denunciar

0

You need to iterate over your json data in returnData. You are not able to put json directy into html. You need to convert / parse / iterate it before. So, for example:

$.each(returnedData, function (index, value) {
    // do stuff with it, e. g.:
    //  $('#result').html($('#result').html() + value);
});
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda