Getting value GET OR POST variable using JavaScript?

前端 未结 9 1629
一个人的身影
一个人的身影 2020-11-27 05:59

How to get value of the get or post variable on page load using JavaScript?

9条回答
  •  心在旅途
    2020-11-27 06:55

    When i had the issue i saved the value into a hidden input:

    in html body:

        
        
    

    ... then put the hidden input on the page and write the value $fid with php echo

        
    

    then in $(document).ready( function () {

        var postId=document.getElementById("fid").value;
    

    so i got my hidden url parameter in php an js.

提交回复
热议问题