Monday 20 November 2017

Server end error?

I am having trouble with, I assume, my node.js server, but only when it finishes, I get an error, but it does go to the server, break points in Visual Studio confirms. I think it may have something to do with xhrStatus.AngularJS 1.6.6:$http({ method: 'POST', url: 'http://localhost:1337/eventCreator', data: $.param(data), headers: {'Content-Type': 'application/x-www-form-urlencoded'} }) .then(function success(res) { $scope.errorText="SUCCESS: "+JSON.stringify(res); } , function error(res) { $scope.errorText="ERROR: "+JSON.stringify(res); });Node.js:router.post('/', function (req, res)//, urlencodedParser { res.writeHead(200, { 'Content-Type': '/' }); var eventDate = new Date(req.body.date); res.end("1"); });AngularJS Error message:{"data":null,"status":-1,"config":{"method":"POST","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"http://localhost:1337/JL","data":"leader=batman&members%5B%5D=superman&guests%5B%5D=WonderWoman&date=Tue+Nov+28+2017+00%3A00%3A00+GMT-0500+(Eastern+Standard+Time)","headers":{"Content-Type":"application/x-www-form-urlencoded","Accept":"application/json, text/plain, /"}},"statusText":"","xhrStatus":"error"}

Submitted November 20, 2017 at 03:40PM by TheMadnessofMadara

No comments:

Post a Comment