[javascript] Failed to load resource: the server responded with a status of 500 (Internal Server Error) in Bind function

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

This question is related to javascript jquery asp.net-mvc-3 jquery-events

The answer is


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 cause 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.

Examples related to javascript

need to add a class to an element How to make a variable accessible outside a function? Hide Signs that Meteor.js was Used How to create a showdown.js markdown extension Please help me convert this script to a simple image slider Highlight Anchor Links when user manually scrolls? Summing radio input values How to execute an action before close metro app WinJS javascript, for loop defines a dynamic variable name Getting all files in directory with ajax

Examples related to jquery

How to make a variable accessible outside a function? Jquery assiging class to th in a table Please help me convert this script to a simple image slider Highlight Anchor Links when user manually scrolls? Getting all files in directory with ajax Bootstrap 4 multiselect dropdown Cross-Origin Read Blocking (CORB) bootstrap 4 file input doesn't show the file name Jquery AJAX: No 'Access-Control-Allow-Origin' header is present on the requested resource how to remove json object key and value.?

Examples related to asp.net-mvc-3

Better solution without exluding fields from Binding IIs Error: Application Codebehind=“Global.asax.cs” Inherits=“nadeem.MvcApplication” Can we pass model as a parameter in RedirectToAction? return error message with actionResult Why is this error, 'Sequence contains no elements', happening? Failed to load resource: the server responded with a status of 500 (Internal Server Error) in Bind function 500.19 - Internal Server Error - The requested page cannot be accessed because the related configuration data for the page is invalid String MinLength and MaxLength validation don't work (asp.net mvc) How to set the value of a hidden field from a controller in mvc How to set a CheckBox by default Checked in ASP.Net MVC

Examples related to jquery-events

Failed to load resource: the server responded with a status of 500 (Internal Server Error) in Bind function Detect Close windows event by jQuery How to bind Events on Ajax loaded Content? Get clicked element using jQuery on event? jQuery click events firing multiple times jQuery.click() vs onClick Bootstrap onClick button event Difference between $(this) and event.target? Getting the class of the element that fired an event using JQuery Attaching click event to a JQuery object not yet added to the DOM