无响应数据Angularjs POST/TypeScript

无响应数据Angularjs POST/TypeScript,angularjs,post,typescript,response,Angularjs,Post,Typescript,Response,我正在尝试测试AngularJS的post方法,但到目前为止,我还没有弄明白如何让它工作 这是我的代码片段 parameter = { categoryName: '' }; <- just a dummy parameter purposely set to '' for testing purposes this.httpService({ method: 'POST', url: '/svc_

我正在尝试测试AngularJS的post方法,但到目前为止,我还没有弄明白如何让它工作

这是我的代码片段

 parameter = { categoryName: '' }; <- just a dummy parameter purposely set to '' for testing purposes

            this.httpService({
                method: 'POST',
                url: '/svc_templates/svc_fetch_category.php',<- Just echoing some JSON string.
                data: parameter
            }).then(function (response) {
                console.log(response);

参数={categoryName:''} 确保服务器
.php
文件使用
curl
实际工作,例如:

curl -X POST -d @filename.txt http://example.com/svc_templates/svc_fetch_category.php --header "Content-Type:application/json"

其中
filename.txt
包含要发送的JSON数据

你检查过开发者工具网络选项卡了吗?他对PHP脚本的响应是什么?我刚检查过,但是脚本没有返回响应。当我从POST到GET修改代码时,它是有效的。当使用像POST和GET这样的HTTP方法时,会发生这种情况吗?POST和GET都可以返回数据。问题是为什么你的PHP脚本没有返回任何东西,不幸的是看不到里面。我只是再次检查了我的脚本,结果发现有一个bug。谢谢你的帮助。