Skip to main content
 首页 » 编程设计

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

2024年10月24日38lyj

我对 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 无关,首先请确保您的“脚本”返回一个带有 200 结果代码的正确 HTTP 响应。

您可以使用 curl 或 wget 在执行任何其他操作之前调试结果。