I am using JSON.Stringify() in my javascript...
var jsonProp;
var json = { };
json.prop= { };
json.prop.Brand = $('.Brand' + val).val();
json.prop.Name = $('.Name' + val).val();
json.prop.Desc = $('.Desc' + val).val();
json.prop.Address = $('.Address' + val).val();
json.prop.Phone = $('.Phone' + val).val();
json.prop.Tag = $('.Tag' + val).val();
json.prop.City = $('.City' + val).val();
json.prop.Status = $('.Status' + val).val();
jsonProp = jsonProp + JSON.stringify(json);
and the result is :
"undefined{"prop":{"Brand":"","Name":"apotik AA","Desc":"","Address":"Address","Phone":"","Tag":"","City":"BEKASI","Status":"0"}}
{"prop":{"Brand":"","Name":"apotik AAaaaa. Bina Farma","Desc":"","Address":"Jl. RA. Kartini, Margahayu-Bekasi Tim., Kota Bks, Jawa Barat 17113","Phone":"","Tag":"","City":"BEKASI","Status":"0"}}"
why is "undefined" there? how can I set it? all I want to have is a JSONArray like this :
Prop{{"Brand":"value","Name":"value"},{"Brand":"value","Name":"value"}}
Please help
jsonProp = jsonProp + JSON.stringify(json);at all instead ofjsonProp = JSON.stringify(json);?