Próbuję wysłać połączenie za pomocą ajax, ale w Chrome jest to rosnący błąd, ale w firefoxie nie ma błędu. Ale wciąż nie może wywoływać tej metody. Próbowałem nagrać rozmowę w firebugu, ale w firebugie nie ma żądania połączenia. Dlatego nie ma błędów w Firefoksie.Załadowanie zasobu nie powiodło się: serwer odpowiedział stanem 500 (Błąd wewnętrznego serwera) w funkcji powiązania.
Index.chshtml kod jest poniżej
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);
}
});
});
});
});
}
sposób kontroler
public JsonResult SaveColumnInfo(string columnIndex, string value)
{
CookieHelper helper=new CookieHelper();
helper.UpdateCookie(int.Parse(columnIndex), value.ToString());
return Json("Success");
}
Błąd chromu
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
Robisz post. Czy oznaczyłeś SaveColumnInfo jako HttpPost? – Fals
Tak, próbowałem z HttpPost, ale bez powodzenia. Na innych stronach aplikacji mu używam tej samej metody wywołania ajaxowego bez atrybutu HttpPost i działa on dobrze, jeśli nie. – Haris
Nie sądzę, że ../../GlobalSearch/SaveColumnInfo jest źle! Nie możesz wpisać tego rodzaju adresu URL!/GlobalSearch/SaveColumnInfo powinno działać! – Fals