Commit cdbd47e8 by Patryk Czarnik

próba obsługi błędów

parent 96f1f346
......@@ -8,11 +8,11 @@
function pobierz_dane(evt) {
evt.preventDefault();
let productId = $('#productId').val();
console.log('pid:', productId);
// console.log('pid:', productId);
if(productId) {
let adres = 'products/' + productId;
console.log('adres:', adres);
// alert('Pobieram!');
// console.log('adres:', adres);
// alert('Pobieram!');
let response = $.getJSON(adres, null, (data) => {
// console.log('data:', data);
let html = `<table>
......@@ -24,7 +24,12 @@
// $('#product').text('Nazwa produktu: ' + data.productName)
$('#product').html(html);
});
console.log(response);
// console.log(response);
//if(response.status == 404) {
// $('#product').html("<strong>brak danych</strong>");
//} else if(response.status != 200) {
// $('#product').html("<strong>błąd</strong>");
//}
}
}
......
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