I have four product gallery with the possibility to check the detail of each product from each gallery. Every time the user enter in the detail of any product an array is filled with all the products from that gallery. I should tell this is one single page.
I want to completely delete all the records in the array when the user exits the detail view, because when the user enter again in the detail view the array length increments his size.
I already tried arrayName.length =0; and arrayName.length = [] and it deleted the previous data, but his size continue incrementing like this:
1st time detail view is loaded --> arrayName{valA,valB,valC}
2nd time detail view is loaded --> arrayName{,,,val1,val2,val3}
what it's supposed to be in the 2nd time is: arrayName{val1,val2,val3}
Any idea in how I can solve this issue??
Thanks all
The solution
Thanks all guys. It was my problem.
while($rowDetails = mysql_fetch_array($rsDetails)){
?>
<script language="javascript">
arrayProd[pos] = <?php echo $rowDetails['RefArticleID']; ?>;
pos++;
</script>
...
The array is filled into a while cycle and it increments the pos. At the same time I re-initialize the array I force the pos to be 0 (zero)
arrayProd = [];
pos =0;
Thank you all