These are chat archives for canjs/canjs

Feb 2017
Gira Minus
Feb 25 2017 09:15
Anyone have experience with merging multiple api ajax calls into one?
Frank Lemanschik
Feb 25 2017 09:17
@gKreator in general yes but it depends a bit on your use case

Not possible in most cases

Each ajax call involves the browser sending information to a server at a particular URL.

If you reduced the browser code from two ajax calls to one ajax call, the server would receive less information, the browser would not receive some information it is getting now, and/or the server would perform fewer operations.

If you control the server code, you might be able to change the server code to be able to do both operations in one step. Only then could you change the browser code.

for example to combine database querys i am as couchbase user :) can do simply chain querys and fire one big query
that returns multible results so i can reduce my ajax requests always to 1
but if you talk about for example ajax requests to json endpoints you cant merge them you can only wait till both promises are done
Conclusion merging requests client side is not possible by the coder :)
but http2 is merging such requests on protocol network layer
i am so happy when http2 is full standart then all this bundling packaging caching brings nothing anymore and we have much better applications :)