Thsi似乎不工作:包括json_encode文件()
$msg="Your changes have been saved successfully";
$view=include('application/view/admin/cms/_slides-current.php');
$return_array=array('success'=>true, 'msg'=>$msg, 'view'=>$view);
echo json_encode($return_array);
数组需要被传递回一个jQuery的ajax成功回调。任何人都知道应该怎么做?
包含文件只是一个HTML模板。这个HTML模板将被插入到页面中。
除了使用json_encode()来做我正在做的事情之外,还有什么办法吗?
success: function(result){
alert(result.msg);
if(result.success == true)
{
$('#slides').html(result.view);
}
}
你的包含文件是什么样的。它甚至会返回一些东西吗? – PeeHaa 2012-02-10 10:27:27
^检查我的编辑 – GSTAR 2012-02-10 10:30:05
包含是否返回任何内容? – PeeHaa 2012-02-10 10:30:42