不能 post /file.php 与 ajax 请求
cannot post /file.php with ajax request
我的请求 returns 当我发送 AJAX POST request
时 404 未找到 。我不能 POST /accountf.php
。这是我的代码:
$.ajax({
url: 'accountf.php',
data: {
"getclient": true
},
type: 'post',
success: function(output) {
alert(output);
},
error: function(xhr) {
alert("An error occured: " + xhr.status + " " + xhr.statusText);
}
});
然而,当我使用 get
时,它 returns 整个 PHP 文件作为响应。
您是否正在尝试 post 从 angular javascript 到 PHP,请确保您的 apache/iis 是 运行,并且我认为地址需要用 :80 或类似的方式处理它不能是 angular/Node.js 端口
我只是将请求路径更改为我的 xampp htdocs 文件夹
并将我的 php 文件粘贴到那里,现在可以正常工作了
作为
$.post('http://localhost/bizmanager/backend/accountf.php',
{ "getclient": true },
function(data,status){
alert("Data: " + data + "\nStatus: " + status);
});
谢谢大家
我的请求 returns 当我发送 AJAX POST request
时 404 未找到 。我不能 POST /accountf.php
。这是我的代码:
$.ajax({
url: 'accountf.php',
data: {
"getclient": true
},
type: 'post',
success: function(output) {
alert(output);
},
error: function(xhr) {
alert("An error occured: " + xhr.status + " " + xhr.statusText);
}
});
然而,当我使用 get
时,它 returns 整个 PHP 文件作为响应。
您是否正在尝试 post 从 angular javascript 到 PHP,请确保您的 apache/iis 是 运行,并且我认为地址需要用 :80 或类似的方式处理它不能是 angular/Node.js 端口
我只是将请求路径更改为我的 xampp htdocs 文件夹
并将我的 php 文件粘贴到那里,现在可以正常工作了
作为
$.post('http://localhost/bizmanager/backend/accountf.php',
{ "getclient": true },
function(data,status){
alert("Data: " + data + "\nStatus: " + status);
});
谢谢大家