- Summary
- Based on the code snippet you provided, the logic is to extract the `li_req:y` values (checking boxes) and store them in an array (which is then converted to JSON or HTML).
Here is a complete, working HTML + JavaScript file that performs exactly what is needed to convert the checkbox inputs into a JSON structure suitable for your "Getloyalty" backend.
### The Solution
Save this as an `.html` file (e.g., `data-loyalty.html`) or paste this code into your existing form.
```html
```
---
### Notes:
1. Backend Integration:
The code is ready to send the extracted data to your server's JSON endpoint. Replace the `fetch` call with your actual server endpoint URL (e.g., `http://localhost:3000/getloyalty/data`).
2. Value Extraction:
The value of `yValue` is taken directly from `getAttribute('data-y')`. This handles any custom label values (like "14", "13", etc.) that you might need.
3. JSON Conversion:
The logic extracts `li_req:y` and `li_nm`, then converts the array into a JSON object for the backend.
4. Testing:
Save this code as an `.html` file and open it in your browser to test the checkbox selection.