如何将javascript值存储到jqgrid中的php变量?

时间:2018-04-26 10:01:10

标签: javascript php jqgrid

我在我的脚本中得到了行id值但是分配给php变量它显示了对象对象.. 怎么办呢? 我提到很多答案,但什么都不会发生,我使用了document.write()函数,它无法工作..

 <script>
        function edit()
        {
           // alert("hi");

              var id = jQuery("#list_records").jqGrid('getGridParam','selrow'); 
                if (id) { 
               var ret = jQuery("#list_records").jqGrid('getRowData',id);

               var sampleedit = ret.id;
               document.cookie = "myJavascriptVar = " + sampleedit 
               alert(sampleedit); 


                 } 
                else { 
                    alert("Please select row");
                    } 
        }

        </script>
 <?php
 $servername = "localhost";
$username = "";
$password = "";
$dbname = "dbnew";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
  $myPhpVar = $_COOKIE['myJavascriptVar'];
  echo $myPhpVar;

$sqlselect = "SELECT * FROM userregisterdetails ";
echo $sqlselect;
 ?>

0 个答案:

没有答案