Good day. I send an ajax request to a PHP file and call it back in the hope of getting a page filled with the data I sent. However, PHP, instead of data, returns 0.
Ajax request:
$('#krok-form').submit(function(e) { e.preventDefault(); e.stopPropagation(); var form_data = $(this).serialize(); $.ajax({ type: 'POST', url: 'receipt/krok-receipt.php', data: form_data, success: function(data) { console.log('Data was sent successfuly'); $('#blank-frame').html(data); $('#blank-frame').css({'padding' : '15px'}); $('.must-hide').hide('slow', function(){ $(this).detach(); }); } }); }); The PHP file accepts data as follows:
<?php $username = $_POST['user-fullname']; $address = $_POST['client-address']; $contract = $_POST['contract-id']; $amount = $_POST['amount-payment']; echo 'Приняты данные: \n' + $username + '\n' + $address + '\n' + $contract + '\n' + $amount; ?> The echo function prints 0.