sea

<title>Crypto Communities</title> <style> body { font-family: Arial, sans-serif; } .community { margin-bottom: 10px; } </style>

Crypto Communities

Add a new community

Add Community <script> document.addEventListener('DOMContentLoaded', function() { fetch('/communities') .then(response => response.json()) .then(data => { const communitiesDiv = document.getElementById('communities'); data.forEach(community => { const div = document.createElement('div'); div.className = 'community'; div.innerHTML = `${community.name}: ${community.description}`; communitiesDiv.appendChild(div); }); });
        document.getElementById('communityForm').addEventListener('submit', function(event) {
            event.preventDefault();
            const name = document.getElementById('name').value;
            const description = document.getElementById('description').value;

            fetch('/community', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify({ name, description })
            })
            .then(response => response.json())
            .then(message => {
                alert(message.message);
                window.location.reload();
            });
        });
    });
</script>
document.getElementById('communityForm').addEventListener('submit', function(event) { event.preventDefault(); const name = document.getElementById('name').value; const description = document.getElementById('description').value;
        fetch('/community', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({ name, description })
        })
        .then(response => response.json())
        .then(message => {
            alert(message.message);
            window.location.reload();
        });
    });
});
</script>