Currently I have a button that fires addMultipleToCart - It is supposed to pass in this object that I created called productids
List<String> productids = new List<String>();
Here is how I register the onClick event:
<a id="displayAddToCart" href="#" onclick="addMultipleToCart('@productids');return false;"
role="button" class="btn primary btn-add-to-cart">Add To Cart</a>
When this event gets called, it is supposed loop through the list like so :
this.addMultipleToCart = function (products) {
for (var i = 0, len = products.length; i < len; i++) {
insite.productdetail.addToCartClick(products[i], '1', '');
}
};
However, when products gets passed through, it looks like the object isn't getting passed, but the name of the object type? It looks like this:
products = "System.Collections.Generic.List`1[System.String]"
So, when I loop through, I end up looping through the string
"System.Collections.Generic.List`1[System.String]"
Which is obviously not what I want. How can I access my list using javascript?