Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 856
Haris Avatar asked Oct 04 '13 12:10

Haris


People also ask

How do I fix failed to load the resource The server responded with a status 500?

Solution 1 A 500 internal server error just means something went wrong with your code. You'll need to examine your server logs to find out what the problem is and fix it. But there are plenty of problems with the code you've shown. Your code is vulnerable to SQL Injection[^].

How do I fix error request failed with status code 500?

Reload or Refresh the Webpage Most of the time, the issue is only temporarily and can be corrected by trying the page again. You can use the refresh/reload button, pressing F5 , or by trying the URL again from the address bar.

Why does 500 internal error mean?

The HTTP 500 internal server error is a general-purpose error code that means there is a problem on the website's server, but the exact problem couldn't be definitively identified. In other words, the server doesn't know what the exact problem is.


1 Answers

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.
like image 142
asantaballa Avatar answered Sep 19 '22 10:09

asantaballa