I have some problem with passing value from javascript file to php file. I make some calculations in JS, and after that i passing it to php. This is a code of JS:
var price=100;// for example
$.ajax({
type: "POST",
url: "SecureRide.php",
data: { calculatedPrice: price }
});
And this is a code of PHP:
<?php
session_name("ridePrice");
session_start();
$_SESSION["calculatedPrice"]=$_POST["calculatedPrice"];
echo $_SESSION["calculatedPrice"];
?>
So what i do is a simple Ajax function that passes the value to php, very simple, but doesn't work! When I do echo function there's nothing there. Maybe there are another way to solve it? Thank you very much!