I have an HTML form and send data to php file when hitting submit button.
$.ajax({ url: \"text.php\", type: \"POST\", data: { amount: amount,
Try adding
header('Content-type: application/json');
At the top of your PHP script and see what you get back
Hope that helps!
Edit: Forgot to mention you should access your values like so: data.amount
data.amount