php - Ajax 调用在 PHP 中返回 500 内部服务器错误
问题描述
在发送 Ajax 调用以调用 php 文件时,我在此文件上收到错误消息:
try {
h.send(b.hasContent && b.data || null)
} catch (i) {
if (c)
throw i
}
这是我得到的错误:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
我确信我正在调用的 php 文件具有正确的地址,因为它可以在 localhost 上运行。
下面是我在 jQuery 中用来调用文件的 ajax 调用:
$(document).ready(function(){
$.ajax({
url: 'functions/getParishes.php',
type: 'get',
dataType: 'json',
success:function(response){
var len = response.length;
$('#parish-list').empty()
for( var i = 0; i<len; i++){
$("#parish-list").append("<option value='"+response[i]['ID']+"'>"+response[i]['Name']+"</option>");
}
}
});
});
有人可以说明我可能做错了什么吗?
解决方案
推荐阅读
- javascript - 从 chrome 应用程序中启动第三方 chrome 打包应用程序
- ios - 字典对象数组在 Swift 中发送到 firebase 云函数后发生变化?
- android - 应用关闭后启动带有警报的服务
- gcc - 链接共享库绝对路径与相对路径
- reactjs - 如何使用 Redux/React 更改 e.target.value 的状态?
- prolog - 用于查找列表的最后一个元素的 Prolog 规则
- java - 在 Java 中请求 ID 令牌
- jquery - 使用 jQuery 2.3 与 3.3 更改元素 CSS 高度
- javascript - 使用 JavaScript 将匹配的 HTML 标记替换为 Regexp
- python - 为什么 Python 描述符适用于类级别属性而不适用于实例级别属性