jquery-1.11.3.min.js:5 POST 500(内部服务器错误)与PHP

时间:2015-09-07 03:55:12

标签: javascript php jquery ajax

当我使用ajax调用另一个php页面时

$.ajax({
    url: '/coffee_note/ajax/coffeeN_list.php',
    type: 'POST',
    data: data,
    success: function (msg) {
        $('#shop').html(msg);
    },
    error: function (xhr) {
        console.log(xhr);
    }
});

但它在控制台中显示错误:

POST http://127.0.0.1/coffee_note/ajax/coffeeN_list.php 500 (Internal Server Error)
m.ajaxTransport.a.send @ jquery-1.11.3.min.js:5
m.extend.ajax @ jquery-1.11.3.min.js:5
refreshList @ coffeeN.js:20
(anonymous function) @ coffeeN.js:93
m.event.dispatch @ jquery-1.11.3.min.js:4
m.event.add.r.handle @ jquery-1.11.3.min.js:4

coffeeN.js:28 Object {readyState: 4, responseText: "", status: 500, statusText: "Internal Server Error"}

我不确定我的代码是否错误,但到目前为止我没有发现任何错误。

这是mysql错误报告:

{
    "pma_version": "4.4.10",
    "browser_name": "CHROME",
    "browser_version": "45.0.2454.85",
    "user_os": "Mac",
    "server_software": "Apache/2.4.16 (Unix) PHP/5.5.27",
    "user_agent_string": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36",
    "locale": "en",
    "configuration_storage": "disabled",
    "php_version": "5.5.27",
    "exception_type": "js",
    "exception": {
        "mode": "stack",
        "name": "TypeError",
        "message": "Cannot read property '0' of null",
        "stack": [
            {
                "line": 235,
                "func": "",
                "context": [
                    "                lastException = null;",
                    "                notifyHandlers.apply(null, [stack, null].concat(args));",
                    "            }",
                    "        }, (stack.incomplete ? 2000 : 0));",
                    "",
                    "        throw ex; // re-throw to propagate to the top level (and cause wind//...",
                    "    }",
                    "",
                    "    report.subscribe = subscribe;",
                    "    report.unsubscribe = unsubscribe;",
                    "    return report;"
                ],
                "column": "",
                "filename": "tracekit/tracekit.js"
            },
            {
                "func": "getFieldValidators",
                "line": 302,
                "column": "40",
                "context": [
                    " * @return array of [function, parameters to be passed to function]",
                    " */",
                    "function getFieldValidators(field_id, onKeyUpOnly)",
                    "{",
                    "    // look for field bound validator",
                    "    var name = field_id.match(/[^-]+$/)[0];",
                    "    if (typeof validators._field[name] != 'undefined') {",
                    "        return [[validators._field[name], null]];",
                    "    }",
                    "",
                    "    // look for registered validators"
                ],
                "filename": "config.js"
            },
            {
                "func": "validate_field",
                "line": 418,
                "column": "21",
                "context": [
                    "{",
                    "    var args, result;",
                    "    var $field = $(field);",
                    "    var field_id = $field.attr('id');",
                    "    errors[field_id] = [];",
                    "    var functions = getFieldValidators(field_id, isKeyUp);",
                    "    for (var i = 0; i < functions.length; i++) {",
                    "        if (typeof functions[i][1] !== 'undefined' && functions[i][1] !== n//...",
                    "            args = functions[i][1].slice(0);",
                    "        } else {",
                    "            args = [];"
                ],
                "filename": "config.js"
            },
            {
                "func": "HTMLDocument.<anonymous>",
                "line": 511,
                "column": "13",
                "context": [
                    "    var $check_page_refresh = $('#check_page_refresh');",
                    "    if ($check_page_refresh.length === 0 || $check_page_refresh.val() == '1') {",
                    "        // run all field validators",
                    "        var errors = {};",
                    "        for (var i = 0; i < $elements.length; i++) {",
                    "            validate_field($elements[i], false, errors);",
                    "        }",
                    "        // run all fieldset validators",
                    "        $('fieldset').each(function () {",
                    "            validate_fieldset(this, false, errors);",
                    "        });"
                ],
                "filename": "config.js"
            },
            {
                "func": "HTMLDocument.new_func",
                "line": 279,
                "column": "33",
                "context": [
                    "     */",
                    "    wrap_function: function (func) {",
                    "        if (!func.wrapped) {",
                    "            var new_func = function () {",
                    "                try {",
                    "                    return func.apply(this, arguments);",
                    "                } catch (x) {",
                    "                    TraceKit.report(x);",
                    "                }",
                    "            };",
                    "            new_func.wrapped = true;"
                ],
                "filename": "error_report.js"
            },
            {
                "func": "HTMLDocument.m.event.dispatch",
                "line": 3,
                "column": "8436",
                "context": [
                    "/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/li//...",
                    "!function(a,b){\"object\"==typeof module&&\"object\"==typeof module.exports?mod//...",
                    "if(k&&j[k]&&(e||j[k].data)||void 0!==d||\"string\"!=typeof b)return k||(k=i?a//...",
                    "},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this)://...",
                    ";",
                    "",
                    "function sprintf() {",
                    "/*"
                ],
                "filename": "jquery/jquery-1.11.1.min.js"
            },
            {
                "func": "HTMLDocument.$event.dispatch",
                "line": 374,
                "column": "19",
                "context": [
                    "$event.dispatch = function( event ){",
                    "\tif ( $.data( this, \"suppress.\"+ event.type ) - new Date().getTime() > 0 ){",
                    "\t\t$.removeData( this, \"suppress.\"+ event.type );",
                    "\t\treturn;",
                    "\t}",
                    "\treturn $dispatch.apply( this, arguments );",
                    "};",
                    "",
                    "// event fix hooks for touch events...",
                    "var touchHooks = ",
                    "$event.fixHooks.touchstart = "
                ],
                "filename": "jquery/jquery.event.drag-2.2.js"
            },
            {
                "func": "HTMLDocument.r.handle",
                "line": 3,
                "column": "5139",
                "context": [
                    "/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/li//...",
                    "!function(a,b){\"object\"==typeof module&&\"object\"==typeof module.exports?mod//...",
                    "if(k&&j[k]&&(e||j[k].data)||void 0!==d||\"string\"!=typeof b)return k||(k=i?a//...",
                    "},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this)://...",
                    ";",
                    "",
                    "function sprintf() {",
                    "/*"
                ],
                "filename": "jquery/jquery-1.11.1.min.js"
            },
            {
                "func": "Object.m.event.trigger",
                "line": 3,
                "column": "7537",
                "context": [
                    "/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/li//...",
                    "!function(a,b){\"object\"==typeof module&&\"object\"==typeof module.exports?mod//...",
                    "if(k&&j[k]&&(e||j[k].data)||void 0!==d||\"string\"!=typeof b)return k||(k=i?a//...",
                    "},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this)://...",
                    ";",
                    "",
                    "function sprintf() {",
                    "/*"
                ],
                "filename": "jquery/jquery-1.11.1.min.js"
            },
            {
                "func": "HTMLDocument.<anonymous>",
                "line": 3,
                "column": "15404",
                "context": [
                    "/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/li//...",
                    "!function(a,b){\"object\"==typeof module&&\"object\"==typeof module.exports?mod//...",
                    "if(k&&j[k]&&(e||j[k].data)||void 0!==d||\"string\"!=typeof b)return k||(k=i?a//...",
                    "},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this)://...",
                    ";",
                    "",
                    "function sprintf() {",
                    "/*"
                ],
                "filename": "jquery/jquery-1.11.1.min.js"
            },
            {
                "func": "Function.m.extend.each",
                "line": 2,
                "column": "2973",
                "context": [
                    "/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/li//...",
                    "!function(a,b){\"object\"==typeof module&&\"object\"==typeof module.exports?mod//...",
                    "if(k&&j[k]&&(e||j[k].data)||void 0!==d||\"string\"!=typeof b)return k||(k=i?a//...",
                    "},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this)://...",
                    ";",
                    "",
                    "function sprintf() {"
                ],
                "filename": "jquery/jquery-1.11.1.min.js"
            }
        ],
        "useragent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36",
        "incomplete": "false",
        "partial": "true",
        "uri": "index.php?target=sql.php"
    },
    "script_name": "index.php",
    "microhistory": {
        "current_index": "0"
    }
}

我该怎么做才能解决这个问题?谢谢。

0 个答案:

没有答案