Using ajax to trigger multiple ajax requests at the same time

use ajax to trigger multiple ajax requests at the same time

for example, if there are 10 get requests, I want them to trigger at the same time and request at the same time.

Mar.11,2021

copy 10 directly, or write a loop


var result1;
var result2;
$.when(
    $.ajax({ // First Request
        url: form_url, 
        type: form_method,      
        data: form_data,     
        cache: false,
        success: function(returnhtml){     
                result1 = returnhtml;                  
        }           
    }),

    $.ajax({ //Seconds Request
        url: form_url, 
        type: form_method,      
        data: form_data,     
        cache: false,
        success: function(returnhtml){                          
            result2 = returnhtml;     
        }           
    })

).then(function() {
    $('-sharpresult1').html(result1);
    $('-sharpresult2').html(result2);
});

write 10 in order


write a parameter passing method and call it 10 times

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb1268-2337.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb1268-2337.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?