0👍
✅
Here is the sequence that finally worked for me:
$.each (json.features, function (i, val)
name.push(val.properties.name);
zip.push(val.properties.zip);
});
name
, zip
and tags
are my model columns. The rest is Django’s JSON. I should point out that I am using the GeoJSON serializer here.
Here is a chart I made to help me visualize the JSON pattern:
{"type":
"FeatureCollection",
"crs": {
"type": "name",
"properties": {
"name": "EPSG:4326"
}},
"features": [{
"geometry": null,
"properties": {
"zip": "19146",
"name": "Jamboree",
"tags": []},
"type": "Feature"
},
{
"geometry": null,
"properties": {
"zip": "19146",
"name": "Party",
"tags": []},
"type": "Feature"
}]
}
Thanks to everyone for helping me learn this!
1👍
You’re iterating through the results
value of the JSON, but as you can see from your sample output, there is no such value. You need to iterate through crs.features
.
$.each (json.crs.features, function (i, val) {
name.push(val.properties.name);
zip.push(val.properties.zip);
}
- Django-tastypie: utf8 is incorrect
- SNS notifications to Browser
- Update Form with Django from GET value
- What is a better option to use django-highcharts package to render charts in template or regular ugly rendering in django?
- MultiValueDictKeyError in django if condition
- Configuring a Postgresql POSTGIS database
- Jquery make tab active from another page
- Django Combine Two Tables Through a Third
- Django URL: Multiple URL, same views. Then use {% url %} in template
- Django and Javascript: dependent dropdown not working
Source:stackexchange.com