Php uses $ _ POST or $ _ SESSION [] to pass the parameter _ post_session to the js function. Php uses $ _ POST or $ _ SESSION [] to pass parameters to js functions, _ post_session you can use $ _ POST or $ _ SESSION [] to transmit parameters to js functions in php programming. you can also use the echo statement to output and copy the data to php. use $ _ POST or $ _ SESSION [] to pass the parameter to the js function.
You can use $ _ POST or $ _ SESSION [''] to transmit parameters to js functions in php programming. you can also use echo statements to output parameters.
The code is as follows:
<? Php
Echo "script test ('$ _ POST [userid]'); script";
?>
The above $ _ POST [''] can also be applied to $ _ SESSION [''];
The code is as follows:
<? Php
$ Para = "hello boby! ";
Echo $ para; // www.jb51.net
Echo "script var para = \" $ para \ "; alert (para); script";
?>
Passing parameters in JS and PHP
I think there are two methods:
First, if you get the parameter value through the get method in php:
You can directly use js to switch to the PHP file address:
Window. location. href = 'mis/vocat/service. php? Param = xx'
Second: pass the value through ajax
I am using the js Library: jquery
If you pass only one parameter param, you can directly write it as the value of param: param.
If there are multiple parameters, it is written as: parameter 1: value of parameter 1, parameter 2: value of parameter 2
$ (Function (){
$. Post ('mis/vocat/service. php', {param: value}, function (){
// Processing required by js after php returns the corresponding data
});
})
Passing the value of js function parameters between js and php
In this way, you use js variables in php. this is not feasible and cannot be implemented.
First of all, you need to understand that php scripts are compiled for the first time. after php is compiled, html and javascript will be executed.
I think your requirements can be implemented without javascript. you can use get/post to transmit the value of this sid. if you want to update the sid, you need to use ajax asynchronous implementation.
Long-winded:
Php variables can be used in js, but not vice versa.
Callback can use $ _ POST or $ _ SESSION [''] to transmit parameters to js functions in php programming. you can also use echo statements to output and copy parameters...