Last active
November 19, 2015 19:50
-
-
Save stianeklund/de4935c2bca2e88828cd to your computer and use it in GitHub Desktop.
Trying to write to JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = { | |
"customers": [{ | |
"firstName": "John", | |
"lastName": "Smith", | |
"age": 25, | |
"address": { | |
"streetAddress": "20 Broadway St", | |
"city": "New York", | |
"state": "NY", | |
"postalCode": "10021", | |
"phoneNumber": "212 555-1234" | |
} | |
}] | |
}; | |
var customersrepo = JSON.parse(data); | |
function returnOrder() { | |
for (i = 0; i < 4; i++) { | |
if (orderForm.orderCheckbox[i].checked) { | |
confirm("Hi " + orderForm.firstName.value + " " + | |
orderForm.lastName.value + ", you've ordered " + | |
orderForm.orderCheckbox[i].value); | |
customersrepo.customers[0].firstName = orderForm.firstName.value; | |
customersrepo.customers[0].lastName = orderForm.lasvName.value; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment