jquery ajax call to WCF service passing data with a data type "long" value sends 0
<p>I have a service contract with a method as follows:</p>

<pre><code>[OperationContract]
    [WebInvoke(Method = "POST",
                               RequestFormat = WebMessageFormat.Json,
                               ResponseFormat = WebMessageFormat.Json,
                               BodyStyle = WebMessageBodyStyle.Bare,
                               UriTemplate = "FibonacciNumber/")]
    long FibonacciNumber(long n);



public long FibonacciNumber(long n)
    {
        var a = 0;
        var b = 0;

        for(var i = 0; i &lt;= n; i++)
        {
            if(i == n)
            {
                return a;
            }

            var c = a;
            a = b;
            b = b + c;
        }

        return 0;
    }
</code></pre>

<p>However, when I try to call the above with a jquery ajax call, the value of the parameter "n" is 0 when the FibonacciNumber service gets hit, any idea what may be wrong? I did console log the value of "$('#fibIndex').val()" and it shows the correct value on the client:</p>

<pre><code>$('#btnFib').on('click', function () {
        fibIndex = $('#fibIndex').val();

        $.ajax({
            url: "http://localhost:61924/MyService.svc/FibonacciNumber/",
            type: "POST",
            dataType: "json",
            data: Number(fibIndex),
        }).done(function (data) {
            $('#fibResult').html(data);
        }).fail(function () {
            console.log("error");
        });
    });
</code></pre>

<p>Thank you in advance for shedding some light in this regards.</p>