good day :)
currently I am using JQuery 1.9.1.js, for searching the records using JSON.
I can able to get the search list in the local, but when I tried to publish into the windows server 2008 and IIS 7, I am unable to get the expected result, since its throwing an error stating "event.returnValue is deprecated. Please use the standard event.preventDefault() instead."
and
"GET http:/localhost:AAA/User/FindGWCLoginUsers?strSearch=suresh 500 (Internal Server Error) "
as per the below link : event.returnValue is deprecated. Please use the standard event.preventDefault() instead
I tried downloading the jquery-1.11.js, and published into the server but still I am getting the same error.
but I dint exclude the jquery-1.9.1.js from the solution because its referencing in many places.
so need your suggestion to rectify this error whether I need to replace all the jquery-1.9.1.js reference with the latest jquery-1.11.js file and publish.
Thank you in advance :)
find the below code for your reference :
calling in .cshtml
$("#btnSearch").click(function () {
if ($("#txtSearch").val() == '') {
alert("Search Box must have search value");
$("#txtSearch").val('');
$("#lblNoEmployee").hide();
$("#tblResult tbody tr").each(function () {
this.parentNode.removeChild(this);
});
$("#tblResult").hide();
$("#divScollable").hide();
$("#sdialog").width(searchBoxWith);
$("#sdialog").height(searchBoxHeigh);
// $("#sdialog").width('214');
// $("#sdialog").height('154');
}
else {
$("#tblResult tbody tr").each(function () {
this.parentNode.removeChild(this);
});
$.getJSON(
'@Url.Content("~/SecUser/FindGWCLoginUsers")',
{
siteId: $("Select#tbl_UserProfile_Site").val(),
strSearch: $("#txtSearch").val()
},
function (employeeRecord) {
var empCollections = employeeRecord;
var items = "";
$.each(employeeRecord,
function (i, empCollections) {
$("#tblResult").find('tbody')
.append($('<tr>')
.append($('<td>')
.addClass('tdSelect')
.attr('id',
empCollections.EMPLOYEE_ID + "_" +
empCollections.EMPLOYEE_NAME + "_" +
empCollections.EMPLOYEE_EMAIL + "_" +
empCollections.LOCATION + "_" +
empCollections.LOCATION_CODE + "_" +
empCollections.DEPTID + "_" +
empCollections.DEPARTMENT_NAME + "_" +
empCollections.EMPLOYEE_EXTENSION + "_"
)
.text('Select')
)
.append($('<td>')
.text(empCollections.EMPLOYEE_ID)
)
.append($('<td>')
.text(empCollections.EMPLOYEE_NAME)
)
.append($('<td>')
.text(empCollections.DEPARTMENT_NAME)
)
);
});
var rowCount = $('#tblResult tr').length;
if (rowCount > 1) {
$("#divScollable").show();
$("#tblResult").show();
$("#lblNoEmployee").hide();
//var tmpWidth = $("#tblResult").width();
$("#sdialog").width('450');
$("#sdialog").height('290');
$(".tdSelect").click(function (e) {
var btnId = ($(this).attr('id'));
var strArray = btnId.split("_");
//clear all the text
$("#UserID").val('');
$("#UserName").val('');
$("#EmailAddress").val('');
$("#LOCATION").val('');
$("#DEPTID").val('');
$("#DEPARTMENT_NAME").val('');
$("#EMPLOYEE_EXTENSION").val('');
//rebind all new values
$("#UserID").val(strArray[0].toString());
$("#UserName").val(strArray[1].toString());
$("#EmailAddress").val(strArray[2].toString());
$("#LOCATION").val(strArray[3].toString());
$("#LOCATION_CODE").val(strArray[4].toString());
$("#DEPTID").val(strArray[5].toString());
$("#DEPARTMENT_NAME").val(strArray[6].toString());
$("#EMPLOYEE_EXTENSION").val(strArray[7].toString());
$("#tblResult tbody tr").each(function () {
this.parentNode.removeChild(this);
});
$('#mask').hide();
$('.window').hide();
$("#tbl_UserProfile_Site").show();
$("WDMEmployee").show();
$("#tbl_UserProfile_RoleId").show();
$("#tbl_UserProfile_ActiveFlag").show();
$("#sdialog").width('214');
$("#sdialog").height(searchBoxHeigh);
checkUserIfExists(strArray[0].toString());
});
}
else {
$("#tblResult").hide();
$("#lblNoEmployee").show();
$("#tblResult").hide();
$("#divScollable").hide();
$("#sdialog").width(searchBoxWith);
// $("#sdialog").width('214');
$("#sdialog").height('180');
}
});
}
});
Controller :
public ActionResult FindGWCLoginUsers(string strSearch = "")
{
try
{
GWCLOGINEntities db = new GWCLOGINEntities();
var result = (
from aa in db.VW_ALL_EMPLOYEE
where aa.EMPLOYEE_ID.Contains(strSearch)
|| aa.EMPLOYEE_NAME.Contains(strSearch)
select aa
).Take(15);
return Json(result, JsonRequestBehavior.AllowGet);
//return
// Json(result.Any() ? result.AsEnumerable().Cast<LU_EEN_DETAILS>().ToList() : null
// , JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
throw ex;
}
}