Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("#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++){
- data.day = data.days[i]; //eg. data.day = "1"
- prices.push(data);
- }
- }
- [1] => {day: 1, price: 1200}
- [2] => {day: 3, price: 1200}
- [3] => {day: 3, price: 1200}
- [1] => {day: 4, price: 1200}
- [2] => {day: 4, price: 1200}
- [3] => {day: 4, price: 1200}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement