New answers tagged

2

The fact that you are making three separate trips to the server stands out as an obvious refinement opportunity. We don't know exactly where your performance bottleneck is, but you can be sure that best practice is to reduce your total trips to ...well, anywhere. Think about it like this: Your mother tells you to go to the shop and get a dozen eggs. You ...


0

Have you tested the server response time independently of your frontend code? The page being slow might not be because of your code being inefficient, if the server or database takes a long time then there's nothing you can do to fix that on the frontend side. That being said, first thing you should do with this code is to look up some standards for PHP and ...


1

.Naming variables / constants properly would make your code more readable var o = data[0]; // becomes const firstuser = data[0]; Magic numbers should be converted into named constants. if (type == 1){ } else { loadatagroup(id); } // becomes if (type!==TYPE_DONT_LOAD) loaddatagroup(id); You mentioned efficiency. You're querying the DOM a lot. ...


1

Since you are using jquery, you can use its built in each function to loop through the json results, which will eliminate the need for the size function. i = index, v = values $.each(data,function(i,v){ $("#list_box").append("<option value='"+v.idgrupo+"'>"+v.nome+"</option>"); })


Top 50 recent answers are included