New question

Question:

Date: 30-12-2019 07:03:49 (In Spanish)

PREGUNTAS API MERCADO LIBRE[Unanswered]

Saludos, estoy tratando de obtener información del recurso items y questions en una misma función, el codigo que tengo es el siguiente:

function jenny()
{
var token = $("#token").val();
var status = "UNANSWERED";

MELI.init ({ client_id : xxxxxxxxxxxx,
xauth_protocol: "https://",
xauth_domain: "secure.mlstatic.com",
xd_url: "/org-img/sdk/xd-1.0.4.html"

});


MELI.get("/my/received_questions/search?",{"access_token":token,"status":status}, function(response) {

// ciclo para mostrar la informacion de las preguntas


var results = response[2].questions;
for (var i = 0; i < results.length; i++) {
//se asigna a item cada uno de los objetos devueltos que se encuentran en el array
var item = results;
var arti = item.item_id;

MELI.get("/items/",{"id":arti}, function(data) {


var titulo = data[2].title;
var img = data[2].thumbnail;
var enlace = data[2].permalink;




$("#arelis").append(
"<div class='col-md-6'>" +
"<div class='form-group'>" +
"<label for='articulo'>" + titulo +"</label>" +
"<img class='img-responsive img-thumbnail' src='"+ img +"'>" +

"<p>Pregunta:"+ item.text +"</p>" +
"<input type='text' name='resp' id="+ item.id +" class='form-control'>" +
"<input type='text' name='segundo' id='segundo' class='form-control' value="+ item.id +">" +

"</div>" +
"<input type='button' class='btn btn-success' value='Responder' onClick='responder();'/>" +
"<a href="+ enlace +" class='btn btn-success'>Ver en Mercado Libre</a>" +

"</div>"

);


// ciclo para mostrar la informacion de las preguntas
});
}

});

$("#inicial").attr("disabled","true");

}?

La idea es asignarle al campo de texto el id correspondiente a cada pregunta,lo intento capturar en "item.id", el problema es que le asigna el mismo id a todas, cómo podría s?olucionarlo?.muchas gracias de antemano.

Tags: API - HTML - Javascript - Mercadolibre API Votes: 0 - Answers: 0 - Views: 6 Share on: Google Facebook Twitter LinkedIn Link
 

Answers:

No replies for this question, be the first to answer.
To actively participate in the community first must authenticate, enter the system.Sign In
 
frjcbbae garagebible.com