pass variables from javascript to php with a cookie -


this has been asked before, want can avoid refreshing page caused post , get, , ajax seems right way

but wondering if can make cookie javascript , (from same page) access php. possible?

small example:

//html code: <form name="plform" onsubmit="myfunction()">    <input type="text" name="plname"/> </form>  //js part: myfunciton() {    var cname = "playlistname";    var cvalue = document.form["plform"]["plname"];    document.cookie = cname + "=" + cvalue; }  //in php: <?php    $x = $_cookie["playlistname"];    //some code ?> 


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -