I have a use case where there will be a filter. Based on the filter, the page content has to change. Now I want to use that filter condition somewhere else in the page.
To do this, I can't afford to use the AJAX. That is why am using a simple JS variable. So is there any way to pass JS variable's value to PHP variable which can be used without loading the page?
I have a JavaScript variable with some value. and i need to assign that value to the PHP variable without loading the page or without using Session and cookies.
<script>
var myJavascriptVar = $('#phase').val();
document.cookie = "myJavascriptVar = " + myJavascriptVar
<?php
$myPhpVar= $_COOKIE['myJavascriptVar'];
?>
</script>
//i tried this but it was not usefull without page load.
PHP code:
<a href="tickets.php?project=<?php echo $myPhpVar; ?>">
<div class="col-md-3">
<div class="example">
<div class="panel widget" style="margin-bottom: 15px;">
<div class="panel-body text-center padding-6" tabindex="0" style="background-color:MediumSeaGreen">
<div class="m0 Currenttotal" style="font-size: 20px;color:white;"></div>
<div class="m0 totaltickets" style="font-size: 20px;color:white;"><?php echo $tickets_count;?></div>
<h5 style="margin-top: 3.5px;margin-bottom: 3.5px;color:white;">Current Month Tickets count</h5>
<div class="col-xs-7 text-right">
<em class="fa fa-tags fa-1x" style="color:white;"></em>
</div>
</div>
</div>
</div>
</div>
</a>
Consider the screenshot added.Here is the reference image
In the above picture, there is a filter. I need to pass that value to the cards below so that, after clicking on a card I can redirect to respective pages and show the filtered records by using the selected filter in the drop down