Php Ajax调用始终返回错误函数
我有一个php页面,页面显示在一个iframe中,该页面包含一个ajax调用 代码如下所示Php Ajax调用始终返回错误函数,php,jquery,ajax,Php,Jquery,Ajax,我有一个php页面,页面显示在一个iframe中,该页面包含一个ajax调用 代码如下所示 $.ajax({ url: "mindex.php", data: { model: "test", handler: "test_123", data: info }, type: "post",
$.ajax({
url: "mindex.php",
data: {
model: "test",
handler: "test_123",
data: info
},
type: "post",
dataType: "json",
success: function(response){
if( response.success ){
createChart( response.times );
}else{
$('#chart-container').html( '<p style="margin: 20px 100px; color: rgb(204, 71, 71);">'+response.errors+'</p>' );
}
},
error: function(){
alert("Unknown error Occured");
}
});
$.ajax({
url:“mindex.php”,
数据:{
模型:“测试”,
处理程序:“test_123”,
数据:信息
},
类型:“post”,
数据类型:“json”,
成功:功能(响应){
if(response.success){
createChart(response.times);
}否则{
$(“#图表容器”).html(““+response.errors+”
”);
}
},
错误:函数(){
警报(“发生未知错误”);
}
});
运行此页面后,始终显示“发生未知错误”;
Firebug显示无响应(空白)
此页面在我的本地主机中工作,但联机显示错误
请帮帮我
thax提前调用
ajax
没有问题
从mindex.php
必须以json
格式返回输出
使用echo json_encode($response)在
mindex.php
文件中。确保您的生产环境中的url是正确的问题在于mindex.php
中的内容,而不是ajax。检查你的PHP错误日志,它可能会产生一个致命的错误,这将解释空白响应。还请检查响应的返回代码,致命错误将返回500内部服务器错误
。url正确,响应未显示在firebug中,显示为空白,错误登录中未发现错误使用iframe有任何问题,页面加载在iframe中