jquery ajax调用返回php文件内容

时间:2022-12-05 14:37:11

I have a jQuery ajax function which queries a php file (carousel.php) and does some stuff with the result. This all works fine on our development server, but on our live server the script seems to fail and returns the content of the PHP file (the raw code). So the PHP isn't even executed. What could be the case here?

我有一个jQuery ajax函数,它查询一个php文件(carousel.php)并对结果做一些事情。这一切在我们的开发服务器上运行良好,但在我们的实时服务器上,脚本似乎失败并返回PHP文件的内容(原始代码)。所以PHP甚至没有被执行。这可能是什么情况?

        $.ajax({
        url: 'carousel.php',
        dataType: 'json',
        cache: false,
        success: function(result){
            if(result.success){
                if (result.numRows == 0) {
                    $('#insert').css('display','none');
                }
                $('#selectBox').html(result.html);
            } 
        }
    })

1 个解决方案

#1


3  

You probably use <? tag in your php file and short open tag is not enabled on your server.

你可能用

#1


3  

You probably use <? tag in your php file and short open tag is not enabled on your server.

你可能用