Pages

Calling an passing data to a POST API

// function for checkbox click
function updatePermission(checkbox) {
    const PermissionId = parseInt(checkbox.id);
    const RoleId = getqsValue();

    updatePermAPI(PermissionId, RoleId);
}

// get role id
function getqsValue() {
    const urlParm = new URLSearchParams(window.location.search);
    return urlParm.get('id');
}

function updatePermAPI(PermissionId, RoleId) {
    const permUrl = `${window.location.origin}/api/roles/updatepermission`;
    const method = "POST";

    const data = {
        PermissionId: PermissionId,
        RoleId: RoleId
    }

    console.log("API URL:", permUrl); // Log the complete API URL

    fetch(permUrl, {
        method: method,
        body: JSON.stringify(data),
        headers: {
            "Content-Type": "application/json"
        }
    })
        .then(response => response.json())
        .then(data => {
            console.log(data); // Log the response data
        })
        .catch(error => {
            console.error(error); // Log the error
        });
}

on button click add text boxes and delete script

  <button onclick="addField()" class="btn btn-outline-primary mb-3 btn-sm" type="button">+ Add Field</button>


                        <div id="fieldSection" class="mb-3"></div>


let fieldCount = 0;


function addField() {

    fieldCount++;


    const textboxName = `newfield_${fieldCount}`;


    const textbox = document.createElement("input");

    textbox.type = "text";

    textbox.name = textboxName;

    textbox.classList.add("form-control", "mb-2");


    // Remove button


    const removeBtn = document.createElement("button");

    removeBtn.textContent = "X";

    removeBtn.classList.add("btn", "btn-sm", "btn-outline-danger");

    removeBtn.addEventListener("click", () => {

        removeField(textboxName);

    });


    const fieldContainer = document.createElement("div");

    fieldContainer.classList.add("fieldContainer");

    fieldContainer.appendChild(textbox);

    fieldContainer.appendChild(removeBtn);


    const fieldSection = document.getElementById("fieldSection");

    fieldSection.appendChild(fieldContainer);

}


function removeField(textboxName) {

    const removable = document.querySelector(`input[name="${textboxName}"]`).parentNode;


    const fieldSection = document.getElementById("fieldSection");

    fieldSection.removeChild(removable);

}

Best Torrent Colud - seedr.cc

https://www.seedr.cc



  https://www.seedr.cc/ is one of the best or else the best ever torrent cloud which you can use free up to 2 GB limit. No other torrent cloud gives you this advantage. This is the most secure way to download torrent files to your personal computer. you can view files online without downloading. This is an amazing feature of this torrent cloud. This is one of the fastest way to download your files too.  Seedr introduces you to a new era of torrent downloading. This torrent cloud elable you to download torrent files directly from the cloud without installing any software like utorrent or bittorrent. This reduce the hassle of using your computer connecting to a torrent seed network and reduce the damage and save your mobile data. 

Best Food Fitness and Wellness for Healthy Living Blog

We have launched a Food Fitness and Wellness for Healthy Living Blog. Health and wellness blog - Learn about Best Healthy Food Fitness Tips and Wellness for Healthy Lifestyle .

Rest review your web site for SEO speed performance design

Test review your web site for 5USD SEO speed performance design





Why me ? Im a Web Designer and Developer with over 7 Years of Experience. 

Web site Testing will Includes

Web Developer Testing - SEO Testing, Page Performance , Speed Testing , Web Page Size  
Website User Testing -  Accessibility Test, Usability Check, Spelling Check
Web Design Testing - Responsive Web Test , Mobile Design Test
CSS HTML Bug Fix / CSS HTML Error Fixing (Extra Service)
Mobile Responsive Issue Fix (Extra Service)

I will send you a report and advice how to fix the issue on your web site.

by this gig you can improve and optimize your website SEO, Loading time and User Experience. 

Search This Blog