嗨所以我有以下js代码调用mail.php
/////string that store switch state.. put this status while sending values to database
String status="false";
//////set the switch to ON
mySwitch.setChecked(false);
//////attach a listener to check for changes in state
mySwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,boolean isChecked) {
if(isChecked){
status="true"; //edit here
}else{
status="false"; //edit here
}
}
});
当进行ajax调用时:在我的控制台中它显示POST http://localhost:8080/mail.php 404(Not Found),并且XHR响应说:不能POST /mail.php
一个类似的帖子提到检查同一目录中的文件是否正确。当我手动输入url localhost:8080 / mail.php时,它会下载该文件。我安装了php,我在webpack-dev中运行并做出反应。