I have a JavaScript variable, and I want to send via POST to a PHP page and I want to display the new page. I tried this solution, but it seems not work. I have checked within Wireshark, and the variable (key and value) are sent correctly, but the page, doesn't show anything.
$(document).ready(function() {
            $("#tbID tr").click(function() {
                $(this).addClass('selected').siblings().removeClass('selected');
                var value = $(this).find('td:nth-child(2)').html();
            });
        });
        function send(value) {
            $.post("newPhp.php", {
                key : value
            }).done(function(data) {
                location.href="newPhp.php";
            });
        }
The newPhp.php:`
    if(!empty($_POST["key"])){
        $value  = $_POST['key'];`
//something with $value
}
So what is the problem with this code ? Are there any simpler solution ?
 
    