Hot answers tagged

4

As this question was asked nearly four years ago it is likely the case that you have learned more about JavaScript since then and/or changed this code. Nonetheless perhaps the info below will help you and/or somebody else. It is interesting that The BackBoneJS documentation uses some valid JSON for specifying the keys of objects but not all. The keys in the ...


2

Client-side validation can improve the UX and clarify the expected field values for well-behaved users, but the naughty folks that want to interact with your application will have no trouble bypassing these barriers to submission. All of the restrictions that you impose in the jquery validate() call must be duplicated in the php script if you want to truly ...


2

I have a few suggestions for optimizing your code. Since ES6 came out it is considered best practice to declare variables as const. It is also a good practice to declare your variables at the top of your script. For example you are selecting the element #ddlApplicationType everytime you loop over your array. That is not necessary. Just select it once at the ...


1

Return Value The method addUser returns false for all negative cases. Below it is possible to see that it does not return true for the positive case.. instead it returns nothing which leads to an undefined: else { $('#loadingDiv').show(); $.post('process/editUser.php', {uobj:uobj}, function(data) { var modal = "#addUserModal"; $('#...


1

I see you removed the calls to $('#loadingDiv').show(); from the many conditional blocks and moved that before the call to the AJAX call - I was going to suggest that. I see the ecmascript-6 features like the Class syntax are used, so other ES-6 features could be used - like the short-hand syntax - i.e. on this line: $.post('process/editUser.php', {uobj:...


1

I already gave many suggestions in my review of your previous question. I see that some of the advice has been incorporated - e.g. "use strict", using the spread operator, etc. Yet it seems some of the advice hasn't been used (e.g. variables starting with $, using jQuery more, etc.) but I won't lose sleep about those. I suggest avoiding use of var ...


Only top voted, non community-wiki answers of a minimum length are eligible