Print queue

I'm facing a problem with my Zebra browser printing code.

I'm using the following code:

var url = 'http://www.example.com/image.jpg';

selected_device.sendUrl(url, undefined, errorCallback);

Result: ok

Then I'm using a loop to print more labels:

var url = 'http://www.example.com/';

var i = 0;

for (; i < 10; ) {

     url += i + '.jpg';
     // http://www.example.com/1.jpg, http://www.example.com/2.jpg ...

     selected_device.sendUrl(url, undefined, errorCallback);

 

     i++;

}

So the following images should print:

http://www.example.com/1.jpg

http://www.example.com/2.jpg

http://www.example.com/3.jpg

http://www.example.com/4.jpg

http://www.example.com/5.jpg

But when I check my labels, the order isn't correct, the labels are printed in the following order:

http://www.example.com/1.jpg

http://www.example.com/2.jpg

http://www.example.com/4.jpg

http://www.example.com/3.jpg

http://www.example.com/5.jpg

Does anyone have an idea how I can solve this?