Commit b770aa00 by Patryk Czarnik

Dane produktu w tablece

parent 67b256e0
......@@ -8,12 +8,17 @@
function pobierz_dane(evt) {
// alert('Pobieram!');
let response = $.getJSON('products/1', null, (data) => {
console.log('data:', data);
$('#product').text('Nazwa produktu: ' + data.productName)
// console.log('data:', data);
let html = `<table>
<tr><th>id</th><td>${data.productId}</td></tr>
<tr><th>Nazwa</th><td>${data.productName}</td></tr>
<tr><th>Cena</th><td>${data.price}</td></tr>
<tr><th>Opis</th><td>${data.description}</td></tr>
</table>`;
// $('#product').text('Nazwa produktu: ' + data.productName)
$('#product').html(html);
});
console.log(response);
}
$(document).ready(() => {
......@@ -28,6 +33,16 @@
border: 4px solid blue;
padding: 1em;
}
table {
border-collapse: collapse;
background-color: #FFFFEE;
}
table th, table td {
border: 1px solid black;
padding: 2px;
}
</style>
</head>
<body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment