How to create URL array in ajax URL?

Ive 6 url which needs to be executed in parallel thru ajax call…Instead creating six individual ajax call,I want to create array containing all the url and want to pass the array as URL in ajax.

Below is my ajax script

    var arr= [ "url1" to "url6"];
      
           $.ajax({
        url : arr,  //Need to send array here
        type: 'GET',
        success:function(data1)
        {
            if(data1){ 
			myMap(data1);
            alert(data1);
            }
            else{
              console.log("Data is empty");
            } 
        },
        error: function(xhr) {
            alert('Error!  Status = ' + xhr.status + " Message = " + xhr.statusText);
        }
   });

That won’t work. you can only make a single HTTP request per URL.

However you could simplify response handling by using Promise.all().

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.