python - 无法使用 angularjs 调用 python 文件输出

标签 python angularjs

我对 AngularJS 很陌生。 我正在编写一个代码,根据 python 文件的输出,angularjs 文件应该有不同的 react 。 我不断收到此特定错误

angular.js:10765 GET http://harsha.seq-technology.in/ajax/duplicate_check.py?q=0 500 (Internal Server Error)

我做错了什么? 我的脚本文件如下:

$scope.save_me = function () {
   $scope.dup_yes=1;
   console.log("here");
   $http.get("/ajax/duplicate_check.py",{params{"q":0}}).then(function(response) {
       console.log("here2");
       console.log(response.data);

       if (response.data['login_status'] == 1 ){
          console.log("Mission is a Success\n");
       }
    })
}

我的 python 文件给出的输出如下:

Content-Type: application/json

{"login_status": 1}

非常感谢您的帮助。

最佳答案

这与 angularjs 无关,首先确保你的“脚本”返回正确的 HTTP 响应,结果代码为 200。

在执行其他操作之前,您可以使用 curlwget 来调试结果。

关于python - 无法使用 angularjs 调用 python 文件输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37342874/

相关文章:

javascript - 访问附加 html 中的 ng-repeat 重复数据

javascript - 指令 'alertForm' 所需的 Controller 'loginForm' 无法找到!在 AngularJS 中

java - 网页本地化方法

python - MongoDB:限制来自 $gt 查询的结果(来自 pymongo)

python - 取决于计算 groupby 对象中两个列单元格之间的差异的列

Python文本挖掘

javascript - 如何在多个文件中定义 Controller - AngularJs

angularjs - typescript :找不到名称 'require'

python - Otsu 掩膜内阈值化

python - Cumprod 在 Python 中给出 -inf