1

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;
            }
        }
Community
  • 1
  • 1
Kapil
  • 1,823
  • 6
  • 25
  • 47
  • 1
    It is a harmless warning the error could be because of something else – Arun P Johny Dec 31 '13 at 07:37
  • heard that latest build of jquery versions may be 1.10+ this bug has been solved. As suggested by Arunpjohny its a harmless warning. – Jai Dec 31 '13 at 07:53

1 Answers1

2

Regarding jQuery's event.returnValue thing: it is just a warning, but you will probably want to fix this relatively soon.

The Stack Overflow question you linked to (event.returnValue is deprecated. Please use the standard event.preventDefault() instead) has a great answer up-voted. This warning is not critical, but it is an indicator for you that this will break in the future. You should go through your codebase and change all references to the current version of jQuery to the newest release of 1.x. You may also consider using a non-version-specific filename for your instance of jQuery (e.g. jquery.min.js instead of jquery-1.10.2.min.js) so that you can upgrade by just replacing the same file (and not have to change paths/references elsewhere).

It sounds like you have a second problem, though, the error:

GET http:/localhost:AAA/User/FindGWCLoginUsers?strSearch=suresh 500 (Internal Server Error)

...means that you have some problems with whatever back-end service this is in reference to. A 500 could be anything, though, you'd need to check your server logs to find out what's going on.

Community
  • 1
  • 1
Lochlan
  • 2,666
  • 3
  • 23
  • 25