I am not very knowledgable with AJAX and I am pretty certain it\'s the solution to my problem.
I want to update a php variable on a
It is not possible to change a The reason that it is not possible is that PHP is running Server side, and without a reload you can only change things on the Client side. If it was possible to change PHP variables on the Client side, this would cause a huge security problem. Updating a page using PHP code can only be done by sending a new request to the server, so it can execute the PHP code and send back whatever it outputs. Using ajax you can make these kind of requests in the background, and therefor "change the page without reloading", the reloading actually happens, but in the background and only the relevant part of the foreground page than needs to be updated using javascript. Example ajax solution: onclick: (replace 1 with the value you want to store, or with a var) create a And use onclick.
PHP
variable without reloading and whihout using something like ajax to call a php file. $.get("storeSort.php", {sort:1}, function(data){
//nothing to be done. is just send
});
storeSort.php
with:session_start()
and the value of $_SESSION['sort']
in your page script to determine which jquery function to call.