Changeset 53bad7e for frontend/js/formHandler.js
- Timestamp:
- 01/10/25 00:33:50 (6 days ago)
- Branches:
- master
- Children:
- 1c51912
- Parents:
- c164f8f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
frontend/js/formHandler.js
rc164f8f r53bad7e 1 1 document.addEventListener('DOMContentLoaded', function() { 2 const form = document.getElementById('form-id'); // Ensure the form has the correct ID2 const form = document.getElementById('form-id'); 3 3 const loadingOverlay = document.getElementById('loadingOverlay'); 4 4 … … 27 27 errorMessage += "Внесете дестинација.\n"; 28 28 } 29 30 29 }); 31 30 … … 35 34 } 36 35 37 // Show the loading overlay38 36 loadingOverlay.style.display = 'flex'; 39 37 … … 48 46 .then(response => response.json()) 49 47 .then(data => { 50 51 48 loadingOverlay.style.display = 'none'; 52 49 … … 64 61 const optionDiv = document.createElement('div'); 65 62 optionDiv.classList.add('option'); 66 //Option from67 63 68 64 //image 69 65 const img = document.createElement('img'); 70 66 img.classList.add('image'); 71 img.src = item.imgSrc; // Use item.imageSrc if available67 img.src = item.imgSrc; 72 68 optionDiv.appendChild(img); 73 69 const WrapperDiv = document.createElement('div'); … … 89 85 dateParagraph.textContent = item.dateRange; 90 86 WrapperDiv.appendChild(dateParagraph); 87 const peopleParaghraph = document.createElement('p'); 88 peopleParaghraph.id = 'numPeople'; 89 if(item.numPeople === 1){ 90 peopleParaghraph.textContent = item.numPeople + " лице"; 91 } 92 else peopleParaghraph.textContent = item.numPeople + " лица"; 93 WrapperDiv.appendChild(peopleParaghraph); 94 95 const infoDiv = document.createElement('div'); 96 97 98 99 91 100 //price 92 101 const priceHeading = document.createElement('h1'); … … 97 106 priceParagraph.textContent = item.price + "EUR"; 98 107 WrapperDiv.appendChild(priceParagraph); 108 109 99 110 100 111 // link and button … … 124 135 125 136 optionDiv.appendChild(btnWrapDiv); 126 // Append option div to dataList127 137 dataList.appendChild(optionDiv); 128 138 }); … … 131 141 .catch(error => { 132 142 console.error('Error fetching data:', error); 133 // Hide the loading overlay in case of error134 143 loadingOverlay.style.display = 'none'; 135 144 });
Note:
See TracChangeset
for help on using the changeset viewer.