i have 2 questions about AJAX and Asynch call to a webservice.
1)
When the page is loaded, 18 AJAX requests fired to a webservice page ASMX. You can see in the following picture, only 6 request are treated at the begining and when one of them are completed, another one is accepted.
How can I do to increase the maximum number of taks treated at the same time? From 6 to 18.
One of the AJAX code:
<script type="text/javascript">
var myRetourboxUn;
function RechercherInterventionboxUn()
{
myRetourboxUn = $.ajax({
type: "POST",
timeout: 30000,
cache: false,
url: "/TestAsynch/InterventionRecherche.asmx/HelloWorld",
data: ({}),
dataType: "text",
beforeSend: function(){
$("#tdboxUn").children(".divContenu").hide();
$("#tdboxUn").children(".divChargement").show();
}
}).done(function(msg){
$("#tdboxUn").children(".divContenu").show();
$("#tdboxUn").children(".divChargement").hide();
$("#tdboxUn").children(".divContenu").html("--" + msg);
}).fail(function(jqXHR, textStatus, errorThrown){
$("#tdboxUn").children(".divContenu").show();
$("#tdboxUn").children(".divChargement").hide();
$("#tdboxUn").children(".divContenu").text(textStatus);
});
$(".menu").click(function(){
myRetourboxUn .abort();
});
}
$(function(){
RechercherInterventionboxUn();
});
$(window).unload(function() {
//myRetourboxUn .abort();
});
</script>
The Webservice code:
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class InterventionRecherche
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function HelloWorld() As String
Dim aTemps As DateTime = DateTime.Now
Dim aTest As Integer = 1
Do While aTest < 100000000
aTest += 1
Loop
Return (DateTime.Now - aTemps).ToString
End Function
<WebMethod()> _
Public Function HelloWorld3() As String
Dim aTemps As DateTime = DateTime.Now
Dim aTest As Integer = 1
Do While aTest < 100000000
aTest += 1
Loop
Return (DateTime.Now - aTemps).ToString
End Function
End Class
2) When I want to refresh the page, it stay frozen until all the request are completed. How to tell to not wait when unload the page and automaticaly abort the requests?
Apparently, this behavior is specific to IE as in Chrome, no problem arises when you want to change page. The requests arrive in error then the page is reloaded immediately
Thanks.