Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/393.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 带有Django get的AngularJS:xhr.send(post | | null);_Javascript_Django_Angularjs - Fatal编程技术网

Javascript 带有Django get的AngularJS:xhr.send(post | | null);

Javascript 带有Django get的AngularJS:xhr.send(post | | null);,javascript,django,angularjs,Javascript,Django,Angularjs,我已经在谷歌上搜索了一个小时,所以我希望有人能帮我 我有一个AngularJS控制器: conciergeControllers.controller('GuestCtrl', function GuestCtrl($scope, $routeParams, Message, Guest) { $scope.messages = {}; Guest.get({id:$routeParams.guestId}, function(response) { $scope.guest

我已经在谷歌上搜索了一个小时,所以我希望有人能帮我

我有一个AngularJS控制器:

conciergeControllers.controller('GuestCtrl', function GuestCtrl($scope, $routeParams, Message, Guest) {
  $scope.messages = {};

  Guest.get({id:$routeParams.guestId}, function(response) {
    $scope.guest = response;
    $scope.to = response.phone_number;
    $scope.messages = response.messages;
  });

  $scope.submitMessage = function(body) {
    var message = new Message({body: body});
    message.$save(function() {
      $scope.messages.unshift(message);
    })
  }

});
但是,每次我在表单中发布,它都会给我以下错误:

xhr.send(post || null);
我有一个简单的表格。这是:

<div class="message-container">
  <input value="[[ guest.name ]]" type="text" class="new-message-input" id="new-message" ng-model="body">
  <button class="btn-message" id="message" ng-click="submitMessage(body)">Send</button>
</div>
似乎我需要将表单数据转换为xhr,或者添加一个crsf cookie,但不确定是什么原因导致了这种情况

有什么建议吗


提前谢谢。

什么原因?您没有显示任何错误。您的错误是完全正常的函数调用。@DanielRoseman,很抱歉我的问题不完整。我试图将其与django rest框架一起使用,而该错误实际上是一个身份验证错误,但我刚刚看到一个500错误,因此感到困惑。谢谢