Не могу понять, почему php принимает переменную sessionx с ajax как null?

Вот код ajax:

var sessionx = prompt('ВВЕДИТЕ ID АККАУНТА', '');

$.ajax({
                url: 'show.php',
                type: 'post',
                data: {'session': sessionx},
                success: function(data) {             $.getJSON("show.php",
    function(data){
        $("#username").html(data.username);
        $("#usermoney").html(data.usermoney); 
        alert(data.userm);
});
                },
                error: function() {
                    alert('error');
                }
            });

Show.php:

<?php

$filename = $_POST["session"];

    $username = file_get_contents("users/$filename/name.txt");
    
    $usermoney = file_get_contents("users/$filename/money.txt");
    
    $arr = array('username' => $username,'usermoney' => $usermoney,'userm' => $filename);
    
    echo json_encode($arr);
    
?>

Я прописал возвращаемую переменную в alert и она равняется null только после того как побывает в show.php. помогите пожалуйста разобраться, заранее спасибо.


Ответы (0 шт):