I have an array of paired values
1:9,10:8,20:7
representing quantities and prices/price breaks which I want to iterate through to establish the correct price point to use when a particular quantity is ordered.
var qty = parseFloat($("#qtyInput").val());
var price_array = $("#sku_price_array" + sel_class).val();
var sku_price_array = price_array.split(",");
for (var i=0; i<sku_price_array.length; i++) {
var sku_prices = sku_price_array[i].split(":");
if (qty > sku_prices[i][0]) {
alert(sku_prices[i][1]);
};
};
My alert is not showing the values I intended.
What I'm aiming for is getting the value 1 for sku_prices[i][0] on the first run through, and alerting the value 9 from sku_prices[i][1].
On my first run-through, firebug shows my sku_prices[i][0] value to be 1, but the alert is undefined.
(edit:escape characters removed, thank you)
split? It could be causing your errorsku_pricesisn't a double array