Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <!--[if lt IE 9]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->
</head>
<body>
    <a id="add_pricing" href="#">Add Pricing</a>
    <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
    <script>
        var prices = [];
        $("#add_pricing").click(function(e){
            e.preventDefault();
            data = {
                "price": "1200",
                "days": ["1","3","4"]
            }
            addData(data);
            console.log(prices)
        });
        function addData(data)
        {
            for (i = 0; i < data.days.length; i++){
                prices.push(data);
                data.day = data.days[i];
            }
        }
    </script>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
oldmill1pro
0viewers