Passing jQuery variable to PHP - 500 Internal Server Error
<p>I am trying to pass a jQuery value to PHP as follows:</p>

<pre><code>var your_var_value=1200;

$.ajax({
    type: "POST",
    url: "scripts/php/controllers/tariff.fare.controller.php",
    data: { var_value: your_var_value},
    error:function(request){alert(request.statusText)},
    success:function(result){
        alert(your_var_value);
    }
});
</code></pre>

<p>To the following:</p>

<pre><code>&lt;?php

require_once('models/sql.php');
require_once('models/server.php');
require_once('models/journey.php');

class TariffFareController {

    // If there is no fixed fare, use route calc
    if ($fixed_fare_result == null) {

        $distance=$_POST['var_value'];

        if ($distance &gt; 1100) {
            $fare = 222.00;
        }
        else {
            $fare = 111.00;
        }

        //MORE CODE

}
</code></pre>

<p>But when I do this I get a <code>500 Internal Server Error</code></p>

<p>I know the URL I am passing this to is correct, any ideas ?</p>
