Q:

Passing jQuery Value to PHP

I am calculating the distance between two places using jQuery and I want to pass this value (pickup_distance) for use in PHP. 
I am wanting to send this value to tariff.fare.controller.php for use in the following function:
private static function getFare($int_terminate) {

    // Function

    if pickup_distance(<-- jQuery Value) > 5 {

        // Do Something

    }

}

How could I go about doing this?  I'm aware I can do this via AJAX but being quite new to programming I'm not quite sure how I can do this. 
Any help would be much appreciated! 

A:

using Jquery it's quite easy:
var your_var_value=1200;
$.post("your_php_script.php", {var_value: your_var_value}, function(data){
    alert("data sent and received: "+data);
});

then in your PHP script you get the variable like this:
$distance=$_POST['var_value'];

And what you echo in "your_php_script.php" is returned as the data variable.