pass jquery value to php variable. soda. I have a drop down menu. Once i select the value i wanna pass that value to a php variable. here's my code. The jQuery to change the value of a hidden input. Then use the hidden input value via PHP. Pass jquery value to php variable. Is a request sent for the test.php file? Does the $_GET variable contain the expected information?. jQuery won't be able to run the.load method. Now we have to sort out that variable and pass some PHP information to jQuery. Passing PHP Info to jQuery. Finally, we’re here and about to use the awesome power of wp_localize_script. Replace the lc_load_query code you just put in your functions.php file with the following.
Create an hidden input tag in HTML, then set it’s value as a JSON string with jquery. Next whenever you need that data, simply call the PHP function which returns value of input tag. Now you can convert the JSON data and store it in PHP variabl. Copy and paste this code snippet in the text editor, save it as index.htm and run it in your browser. After this code has been executed, a user is automatically redirected to the main.php page where screen resolution is displayed in the browser window. Now our home and pleaseWaitLabel values can now be accessed inside our jQuery library via the php_vars variable. Since we used wp_localize_script, we won't have to run anything in our header.php and we can safely remove the contents of the