Posting object-array zum Segeln Ursachen "TypeError: Cannot convert Objekt Grundwert'

In meine html-Seite sende ich diesen Beitrag zu meinem Segel-server aber ich kann nicht auf die Daten im controller als erf.param () - Funktion zurück keine sinnvolle Antwort.

Hier ist die web-Seite code

$.post("http://myserver.local/calendar/batch",
            {"batch":[
                {
                    "start_date" : "2014-06-27T09:00:00Z",
                    "title" : "abc",
                    "attendees" : [
                        "Fred Bloggs",
                        "Jimmy Jones",
                        "The Queen"
                    ],
                    "event_id" : "123",
                    "location" : "Horsham, United Kingdom",
                    "end_date" : "2014-06-27T10:30:00Z"
                },
                {
                    "start_date" : "2014-06-27T09:00:00Z",
                    "title" : "another",
                    "attendees" : [
                        "Fred Bloggs",
                        "Jimmy Jones",
                        "The Queen"
                    ],
                    "event_id" : "def",
                    "location" : "Horsham, United Kingdom",
                    "end_date" : "2014-06-27T10:30:00Z"
                }
            ]},
    function (data) {
        console.log("success");
    }
    ).fail(function(res){
        console.log("Error: " + res.getResponseHeader("error"));
    });

Hier ist der controller

module.exports = {
  batch: function (req, res, next){
    console.log("batch called");
    console.log("req.body" + req.body);
    console.log("req.param()" + req.param());
    res.send("ok");
  },

  _config: {}
};

Ich habe versucht mit req.Körper aber das scheint nicht zu enthalten Inhalte.
Dies ist, was bekomme ich in der Ausgabe

batch called
req.body=[object Object]
TypeError: Cannot convert object to primitive value
    at Array.toString (native)

InformationsquelleAutor simondelliott | 2014-06-21

Schreibe einen Kommentar