Get started with ticketbase-js CDN

MIT licensed

Ticketbase-js is a library for interacting with the Ticketbase event management platform.

Tags:
  • ticketbase
  • ticketing
  • widget

Stable version

Copied!

How to start using ticketbase-js CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with ticketbase-js CDN - cdnhub.io</title>
    <script src="https://cdn.cdnhub.io/ticketbase-js/0.1.13/ticketbase.js"></script>
    <style>
        #ticketbase-container { width: 100%; max-width: 600px; margin: 0 auto; }
    </style>
</head>
<body>
    <div id="ticketbase-container"></div>

    <script>
        // Initialize Ticketbase with your API key
        const apiKey = 'YOUR_API_KEY';
        Ticketbase.initialize(apiKey);

        // Create a new ticket form
        const form = Ticketbase.createForm({
            title: 'Example Ticket Form',
            fields: [
                { name: 'issue', type: 'text', label: 'Issue' },
                { name: 'description', type: 'textarea', label: 'Description' },
                { name: 'priority', type: 'select', label: 'Priority', options: ['Low', 'Medium', 'High'] },
            ],
            container: '#ticketbase-container',
        });

        // Attach the form to a submit button
        const submitButton = document.createElement('button');
        submitButton.textContent = 'Submit Ticket';
        submitButton.addEventListener('click', () => {
            form.submit();
        });
        document.body.appendChild(submitButton);
        document.body.appendChild(form.element);
    </script>
</body>
</html>
Copied!

All versions