I'm writing a shopping cart and I'm trying to update the price on the
fly.

So I have this in my .js file:

$(function(){
        $('input.quantityInput').keyup(function(){
                updateQuantity(this);
        });

});

And, I'm starting to write this function:

function updateQuantity(input){
        var tp = "#totalPrice";
        var tilep = "#tilePrice";
        if (i.attr('value') < 10)
                var tilePrice = '6.95';
        else {
                var tilePrice = '5.95';
        }
        var dollars = i.attr('value')*tilePrice;
        $(tp).empty().append(DollarFormat(dollars));
}

But instead of hardcoding the price breaks, I want to make that
dynamic.
The price break is a list which I have in a Coldfusion list variable
in my .cfm file where I include the .js file above.

Any thoughts on how to do this?
Can I pass the list of price breaks variable into Jquery somehow and
then loop through it?

Reply via email to