How to pass JS variable to php?

前端 未结 5 768
春和景丽
春和景丽 2020-11-28 16:53

I have a javascript functions which returns a hash. I need to pass this hash to php to do stuff with it. Whats the best way to do that?

5条回答
  •  迷失自我
    2020-11-28 17:23

    You could use a cookie. How the exchange takes place (AJAX, page reload, whatever) is up to you.

    in PHP: see setcookie()

    in JS: see document.cookie - or perhaps a JS library such as Dojo / jQuery.

提交回复
热议问题