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
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[^].
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.
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.
The 500 code would normally indicate an error on the server, not anything with your code. Some thoughts
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With