Better to have ajax inside or outside for-loop or for-loop at the server side? Javascript [closed]

In general, if you need to load a bunch of small data, its better to have one server endpoint that returns the all the data. It’s simpler for the client side and avoids the overhead of many xhrs. If you have 100 tags, do you really want to invoke 100 xhrs to get them all, not to mention coordinate the callbacks for all 100?

Leave a Comment