As you can see here : ArcGIS REST API
Near 10.3 they included a new parameters so that you can work with query limits, for example you put a limit on your server of only 1000 records per query and you have 3000 records, you'll have to chain 3 requests.
But how? How can I make asynchronous calls that in a loop using dojo? How can I iterate them in a way that I can return all features
Synchronous mockup :
<SPAN class="" style="color: #101094; border: 0px; font-weight: inherit; font-size: inherit;">var</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> query_results </SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">=</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> </SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">[];</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"></SPAN><SPAN class="" style="color: #101094; border: 0px; font-weight: inherit; font-size: inherit;">var</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> limit_hit </SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">=</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> </SPAN><SPAN class="" style="color: #101094; border: 0px; font-weight: inherit; font-size: inherit;">true</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">;</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> </SPAN><SPAN class="" style="color: #858c93; border: 0px; font-weight: inherit; font-size: inherit;">#While this is true means that the query hit the record limit</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"></SPAN><SPAN class="" style="color: #101094; border: 0px; font-weight: inherit; font-size: inherit;">var</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> start_from </SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">=</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> </SPAN><SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit;">0</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">;</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> </SPAN><SPAN class="" style="color: #858c93; border: 0px; font-weight: inherit; font-size: inherit;">#Pagination parameter</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"></SPAN><SPAN class="" style="color: #101094; border: 0px; font-weight: inherit; font-size: inherit;">while</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> </SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">(</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">limit_hit</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">)</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> </SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">{</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> </SPAN><SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: inherit;">Server</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">.</SPAN><SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: inherit;">Query</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">(</SPAN><SPAN class="" style="color: #101094; border: 0px; font-weight: inherit; font-size: inherit;">params</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">={</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">start_from </SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">:</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> start_from</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">},</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> callback</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">=</SPAN><SPAN class="" style="color: #101094; border: 0px; font-weight: inherit; font-size: inherit;">function</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">(</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">result</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">){</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> limit_hit </SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">=</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> result</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">.</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">limit_hit</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">;</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> start_from </SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">=</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> result</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">.</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">results</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">.</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">length</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">;</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> query_result</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">.</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">push</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">(</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">result</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">.</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">results</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">);</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> </SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">}</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"></SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">}</SPAN>