RGHS Hospital List District Wise 2025

"; return; } const totalPages = Math.ceil(filteredHospitals.length / resultsPerPage); const startIndex = (currentPage - 1) * resultsPerPage; const endIndex = startIndex + resultsPerPage; const currentResults = filteredHospitals.slice(startIndex, endIndex); currentResults.forEach(hospital => { const hospitalDiv = document.createElement("div"); hospitalDiv.className = "hospital"; hospitalDiv.innerHTML = `

${hospital.name}

Address: ${hospital.address}

Speciality: ${hospital.speciality}

Contact: ${hospital.contact}

`; resultsDiv.appendChild(hospitalDiv); }); // Create Pagination Controls if (currentPage > 1) { const prevButton = document.createElement("button"); prevButton.textContent = "Previous"; prevButton.onclick = () => changePage(currentPage - 1); paginationDiv.appendChild(prevButton); } if (currentPage < totalPages) { const nextButton = document.createElement("button"); nextButton.textContent = "Next"; nextButton.onclick = () => changePage(currentPage + 1); paginationDiv.appendChild(nextButton); } } function changePage(page) { currentPage = page; searchHospitals(); // Reload the search with the new page }