I have a JSON string(?) that I have returned from $.ajax() and named it data. Some of the values are empty and I need to add values to some of the keys and send it back to my PHP script.
I access the existing values by data.keyName. How do I add or change the values of certain keys in data?
This is what data looks like.
{
"ID":"48",
"userID":"0",
"address":"750 North High Street",
"city":"Columbus",
"state":"OH",
"zip":"43215",
"lat":"39.977673",
"lng":"-83.003357",
"busNumber":"55",
"isClaimed":"N",
"whereFound":"",
"busNum":"",
"email":"",
"fname":"",
"lname":"",
"comments":""
}
data.keyName, you no longer have a JSON string. You have a JavaScript object. JSON has already been parsed into an object for you.