में 500 (आंतरिक सर्वर त्रुटि) की स्थिति का जवाब दिया है, मैं AJAX का उपयोग करके एक कॉल भेजने की कोशिश कर रहा हूं लेकिन क्रोम में यह त्रुटि बढ़ रही है लेकिन फ़ायरफ़ॉक्स में कोई त्रुटि नहीं है। लेकिन फिर भी यह विधि को कॉल नहीं कर सकता है। मैंने फायरबग में अपनी कॉल रिकॉर्ड करने की कोशिश की लेकिन फायरबग में कोई कॉल अनुरोध नहीं है। तो यही कारण है कि फ़ायरफ़ॉक्स में कोई त्रुटि नहीं है।संसाधन लोड करने में विफल: सर्वर ने बाइंड फ़ंक्शन
Index.chshtml कोड
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);
}
});
});
});
});
}
नियंत्रक विधि से नीचे है
public JsonResult SaveColumnInfo(string columnIndex, string value)
{
CookieHelper helper=new CookieHelper();
helper.UpdateCookie(int.Parse(columnIndex), value.ToString());
return Json("Success");
}
क्रोम
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
आप एक पोस्ट कर रहे हैं। क्या आपने SaveColumnInfo को HttpPost के रूप में चिह्नित किया था? – Fals
हां, मैंने एचटीपीपोस्ट के साथ प्रयास किया है लेकिन कोई सफलता नहीं है। एमयू एप्लीकेशन के अन्य पृष्ठों में मैं एक ही एजेक्स कॉल विधि का उपयोग कर बिना एचटीपीपोस्ट विशेषता के उपयोग कर रहा हूं और अगर यह ठीक है तो यह काम कर रहा है। – Haris
मुझे ऐसा नहीं लगता, ../../GlobalSearch/SaveColumnInfo गलत है! आप इस तरह के यूआरएल टाइप नहीं कर सकते!/ग्लोबलशर्च/SaveColumnInfo काम करना चाहिए! – Fals