Hi, not a developer per se in here
The code im using was generated in chatgpt.
I am trying to retrieve data colum values from a hubdb table and public api calls. This is my code, i am not using authentication because i have the public api option in the table.
<h1>Contenido de la Tabla de HubDB</h1>
<table id=“tableData” style=“border-width: 1px; border-style: solid;”>
<tbody>
<tr>
<th style=“border-width: 1px; border-style: solid;”>ID</th>
<th style=“border-width: 1px; border-style: solid;”>Nombre del Producto</th>
<th style=“border-width: 1px; border-style: solid;”>Precio del Producto</th>
</tr>
</tbody>
</table>
<script>
// Portal ID y ID de la tabla en HubDB
var portalId = ####;
var tableId = #####;
// URL de la API de HubDB para obtener los datos de la tabla
var url = `https://api.hubspot.com/cms/v3/hubdb/tables/${tableId}/rows?portalId=${portalId}\`;
// Realizar una solicitud GET a la API de HubDB utilizando AJAX
var xhr = new XMLHttpRequest();
xhr.open(“GET”, url, true);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
var data = JSON.parse(xhr.responseText);
var table = document.getElementById(“tableData”);
// Iterar sobre los resultados y agregarlos a la tabla HTML
data.results.forEach(function(row) {
var newRow = table.insertRow(-1);
var idCell = newRow.insertCell(0);
var nameCell = newRow.insertCell(1);
var priceCell = newRow.insertCell(2);
idCell.innerHTML = row.id;
nameCell.innerHTML = row.name; // Acceder a la propiedad ‘NAME’
priceCell.innerHTML = row.precio_producto; // Acceder a la propiedad ‘PRECIO’
});
}
};
xhr.send();
</script>
This is my database, and with the id values you can see that it connects with the database but only shows Ids, and Producto and Precio values are missing.
Why aren´t the row values showing? Sorry about my english, its not my first language. Hope you can help me.



