Download Ondex.html from Pezh/Login: direct link, hf CLI and curl.
- Browser
- Download file 1.79 kB
-
https://huggingface.co/spaces/Pezh/Login/resolve/main/Ondex.html
- Command line
-
hf download hf://spaces/Pezh/Login/Ondex.html
-
curl -L -o Ondex.html https://huggingface.co/spaces/Pezh/Login/resolve/main/Ondex.html
1.79 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Checkbox List Flask App</title> | |
| <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> | |
| </head> | |
| <body> | |
| <input type="text" id="inputItem"/> | |
| <button onclick="addItem()">Send</button> | |
| <button onclick="listItems()">Check</button> | |
| <div id="checkboxList"></div> | |
| <script> | |
| // Function to add item to list_1 on the server | |
| function addItem() { | |
| let item = $('#inputItem').val(); | |
| $.ajax({ | |
| url: '/add_item', | |
| type: 'POST', | |
| contentType: 'application/json', | |
| data: JSON.stringify({ 'item': item }), | |
| success: function(response) { | |
| if (response.success) { | |
| alert(`Added: ${response.item}`); | |
| } else { | |
| alert('Failed to add item.'); | |
| } | |
| } | |
| }); | |
| } | |
| // Function to list all items and create checkboxes | |
| function listItems() { | |
| $.ajax({ | |
| url: '/get_items', | |
| type: 'GET', | |
| success: function(data) { | |
| let listDiv = $('#checkboxList'); | |
| listDiv.empty(); // Clear existing checkboxes | |
| data.forEach(function(item, index) { | |
| listDiv.append(`<input type="checkbox" id="item_${index}" />`); | |
| listDiv.append(`<label for="item_${index}">${item}</label><br>`); | |
| }); | |
| } | |
| }); | |
| } | |
| // Call listItems on load | |
| $(document).ready(function() { | |
| listItems(); | |
| }); | |
| </script> | |
| </body> | |
| </html> |