Fetch Get with cookies

    0

    0

    RF Fahad Islam

    var myHeaders = new Headers(); myHeaders.append("Cookie", "Cookie_1=value; Cookie_2=value; session=5a67b465-54b3-4ceb-aff3-496d75f28602"); var formdata = new FormData(); formdata.append("sno", blogsno); var requestOptions = { method: "GET", headers: myHeaders, credentials: "include", redirect: "follow", };

    fetch( /follow?sno=${blogsno}, requestOptions ) .then((response) => response.json()) .then((result) => { #Do Something with the result}) .catch((error) => console.

    
        var myHeaders = new Headers();
        myHeaders.append(
            "Cookie",
            "Cookie_1=value; Cookie_2=value; session=5a67b465-54b3-4ceb-aff3-496d75f28602"
        );
    
        var formdata = new FormData();
        formdata.append("sno", blogsno);
    
        var requestOptions = {
            method: "GET",
            headers: myHeaders,
            credentials: "include",
            redirect: "follow",
        };
    
        fetch(
                `/follow?sno=${blogsno}`,
                requestOptions
            )
            .then((response) => response.json())
            .then((result) => {
                #Do Something
    
            })
            .catch((error) => console.log("error", error));
    };
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.