summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorAaron Parecki <aaron@parecki.com>2017-03-07 12:46:36 -0800
committerAaron Parecki <aaron@parecki.com>2017-03-07 12:46:36 -0800
commit974f963d33ab095688d8d4398cfb0790e8d8f3d9 (patch)
tree9cd96f41abee9a45e8e3e0b819b8825aad9074a0 /views
parent985642236c0644eaf540a60c802763ff936ae244 (diff)
fix JSON syntax for itinerary
Diffstat (limited to 'views')
-rw-r--r--views/new-itinerary.php30
1 files changed, 17 insertions, 13 deletions
diff --git a/views/new-itinerary.php b/views/new-itinerary.php
index 029b4c8..e7eab1c 100644
--- a/views/new-itinerary.php
+++ b/views/new-itinerary.php
@@ -167,29 +167,33 @@ $(function(){
var arrival = $(this).find(".leg-arrival-date").val()+"T"+$(this).find(".leg-arrival-time").val()+$(this).find(".leg-arrival-tz").val();
itinerary.push({
- "type": "h-leg",
+ "type": ["h-leg"],
"properties": {
- "transit-type": $(this).find(".leg-transit-type").val(),
- "operator": $(this).find(".leg-operator").val(),
- "number": $(this).find(".leg-number").val(),
- "origin": $(this).find(".leg-origin").val(),
- "destination": $(this).find(".leg-destination").val(),
- "departure": departure,
- "arrival": arrival
+ "transit-type": [$(this).find(".leg-transit-type").val()],
+ "operator": [$(this).find(".leg-operator").val()],
+ "number": [$(this).find(".leg-number").val()],
+ "origin": [$(this).find(".leg-origin").val()],
+ "destination": [$(this).find(".leg-destination").val()],
+ "departure": [departure],
+ "arrival": [arrival]
}
});
});
var category = csv_to_array($("#note_category").val());
+ properties = {
+ itinerary: itinerary
+ };
+ if(category.length > 0) {
+ properties['category'] = category;
+ }
+
$("#btn_post").addClass("loading disabled").text("Working...");
$.post("/micropub/postjson", {
data: JSON.stringify({
- "type": "h-entry",
- "properties": {
- "itinerary": itinerary,
- "category": category
- }
+ "type": ["h-entry"],
+ "properties": properties
})
}, function(response){