I can't get global variables work, maybe somebody knows the answer
because this should be very simple.

The following does not work, the price is not available at the end of
the function in the alert.

function calc_matrix(x, y)
{
        loc = "index.php?module=product";

        var price = 0;
        $.post(loc,
        {
                "request":"xmlhttp",
                "action":"calc_pricematrix",
                "x":x,
                "y":y
        },
        function(data)
        {
                price = Math.round(parseFloat(data)*100)/100;

        });
        alert(price);
}

Reply via email to