Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Cookie JS
maxerxxl
post 20.07.2017, 04:22:24
Post #1





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 29.03.2014

Ostrzeżenie: (0%)
-----


Cześć.

Mam pewien problem. Otóż mam problem ze wczytaniem danych cookies, poniżej kody:

Kod
function setCookie(key,value) {
    var exp = new Date();

    exp.setTime(exp.getTime()+(365*24*60*60*1000));

    document.cookie = key+"="+value+"; expires="+exp.toUTCString();
}

function saveSettings() {
// checkboxy
    for(var i=0;i<SETTINGS.length;i++) {
        setCookie("settings_"+SETTINGS[i],$("#settings_"+SETTINGS[i]).is(":checked"));
    }

// jeden input który nie działa
    var ses = $("#ses").val();

    if (ses) {
        setCookie("ses", ses)
    }

    $("#settingsModal").modal("hide");
}


Kod
if (isset($_SESSION['ses']))
{
    $ses = $_SESSION['ses'];
}

else
{
    $ses = '';
}

<div class="form-group">
    <label>test</label>

    <input type="text" class="form-control" id="ses" value="'. $ses .'" placeholder="test ...">
</div>


Proszę o pomoc !
Go to the top of the page
+Quote Post
aras785
post 24.07.2017, 09:42:05
Post #2





Grupa: Zarejestrowani
Postów: 859
Pomógł: 177
Dołączył: 29.10.2009

Ostrzeżenie: (0%)
-----


Bo w PHP'ie wczytujesz $_SESSION, a powinieneś $_COOKIE
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 16.04.2024 - 06:47