本文介绍了无法加载资源:服务器回应500(内部服务器错误)的绑定功能状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图发送用ajax来电,但在Chrome它上升错误,但在Firefox中没有错误。但仍不能调用方法。我想记录我在Firebug呼叫,但没有在萤火没有呼叫请求。所以这是有在Firefox没有错误的原因。

Index.chshtml code低于

 函数的onLoad(五){    VAR电网= $(本)。数据(tGrid);
    //绑定到网格标题的上下文菜单
    。事件preventDefault();
    $(本).find(T-网头)。绑定(文本菜单',函数(E){
        //要生成等待菜单
        的setTimeout(函数(){
            //绑定到复选框改变事件。上下文菜单有格式为GridName+_contextmenuID
            $('#globalsearchgrid_contextMenu:复选框)改变(函数(){。
                调试器;
                变量$复选框= $(本);
                //选中状态将决定是否列已显示或隐藏
                VAR检查= $(本)。是(:检查);
                //从网格的列集合索引和相应的列
                VAR参数:columnIndex = $(本)。数据(田);                VAR请求={'参数:columnIndex':'+参数:columnIndex +'值':'+检查+'};
                $阿贾克斯({
                    键入:POST,
                    网址:../../GlobalSearch/SaveColumnInfo
                    数据:要求,
                    的contentType:应用/ JSON的;字符集= UTF-8,
                    数据类型:JSON
                    成功:函数(MSG){},
                    错误:功能(XHR,状态,错误){
                        警报(error.responseTextss);
                    }                });
            });
        });
    });
}

控制器方法

 公共JsonResult SaveColumnInfo(字符串参数:columnIndex,字符串值)
    {
        CookieHelper帮手=新CookieHelper();
        helper.UpdateCookie(int.Parse(参数:columnIndex),value.ToString());        返回JSON(成功);
    }

错误铬

  POST HTTP://本地主机:3577 / GlobalSearch / SaveColumnInfo 500(内部服务器错误)
    jQuery.ajaxTransport.send
    jQuery.extend.ajax
    (匿名函数)
    jQuery.event.handle
    jQuery.event.add.elemData.handle.eventHandle


解决方案

500 code通常表示服务器上的错误,而不是与你的code什么。一些想法


  • 谈话服务器开发者获得更多信息。你不能直接获得更多信息。

  • 验证你的参数到调用(值)。寻找任何你可能会认为能区分一个问题,服务器进程。这个过程不应该呀,应该返回你一个更好的code,但错误发生,也有。

  • 可能是间歇性的,就像如果服务器数据库出现故障。可能是值得在其他时间尝试。

I'm trying to send a call using ajax but in Chrome it is rising error but in firefox there is no error. But still it can't calling the method. I tried to record my call in firebug but there is no call request in firebug. So that's the reason there is no error in firefox.

Index.chshtml code is below

function onLoad(e) {

    var grid = $(this).data("tGrid");
    //bind to the context menu of the Grid's header
    event.preventDefault();
    $(this).find(".t-grid-header").bind('contextmenu', function (e) {
        //wait for the menu to be generated
        setTimeout(function () {
            // bind to the checkboxes change event. The context menu has ID in the format "GridName" + "_contextmenu"
            $('#globalsearchgrid_contextMenu :checkbox').change(function () {
                debugger;
                var $checkbox = $(this);
                // the checked state will determine if the column has been shown or hidden
                var checked = $(this).is(":checked");
                // get the index and the corresponding column from the Grid's column collection
                var columnIndex = $(this).data("field");

                var request = "{'columnIndex':'" + columnIndex + "'value':'" + checked + "'}";
                $.ajax({
                    type: "POST",
                    url: "../../GlobalSearch/SaveColumnInfo",
                    data: request,
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (msg) { },
                    error: function (xhr, status, error) {
                        alert(error.responseTextss);
                    }

                });
            });
        });
    });
}

Controller method

 public JsonResult SaveColumnInfo(string columnIndex, string value)
    {
        CookieHelper helper=new CookieHelper();
        helper.UpdateCookie(int.Parse(columnIndex), value.ToString());

        return Json("Success");
    }

Error in chrome

    POST http://localhost:3577/GlobalSearch/SaveColumnInfo 500 (Internal Server Error)
    jQuery.ajaxTransport.send
    jQuery.extend.ajax
    (anonymous function)
    jQuery.event.handle
    jQuery.event.add.elemData.handle.eventHandle
解决方案

The 500 code would normally indicate an error on the server, not anything with your code. Some thoughts

  • Talk to the server developer for more info. You can't get more info directly.
  • Verify your arguments into the call (values). Look for anything you might think could case a problem for the server process. The process should not die and should return you a better code, but bugs happen there also.
  • Could be intermittent, like if the server database goes down. May be worth trying at another time.

这篇关于无法加载资源:服务器回应500(内部服务器错误)的绑定功能状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 15:50