开发者

Internal Server Error (500) when Ajax loads PHP script

I am building an message board application using Javascript and PHP. When I try to load a php script via Ajax, I get a 500 internal server error. If I load basic text instead of php, the Ajax call works fine and the text is displayed.

Anyone know why the server would have trouble with this?

Here's my php file:

<?php
    //Get input from my form
    $from = $_POST["guestbook_from"];
    $msg = $_POST["guestbook_msg"];
    $today = getdate(date("U"));

    recordMessage($from,$msg); //external php function, creates database record

    //Print some html
    echo("&l开发者_开发知识库t;p>");
    echo($msg);
    echo("</p>");
    echo("<h4>");
    echo($from);
    echo("<br />");
    echo("<small>");
    echo("posted on ");
    echo($today[month]);
    echo(" ");
    echo($today[mday]);
    echo(", ");
    echo($today[year]);
    echo("</small>");
    echo("</h4>");
?>


Beyond the HTTP status code, you need to investigate the server's error response too. The response body might be having error messages, if any!

You got to use Firebug. Enable the Console (or Net) tab and you will all HTTP requests and responses.

Internal Server Error (500) when Ajax loads PHP script

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜