javascript - Multiple Paralleled AJAX are taking long server response time -


i have 5 ajax simultaneously in .js file. taking long server response time(minimum 5sec). if call them 1 one each of them executes within 1 sec.

here js code.

$j('.combo').change(function(){         filter_area();         filter_subarea();         filter_propertytype();         filter_pricerange();         filter_bedrooms(); });  function filter_area()  {       var area_id = $j('#inputarea').val();       var operation = $j('#property').val();       var subarea_id = $j("#inputsubarea").val();       var propertytype = $j("#inputpropertytype").val();       var pricerange = $j("#inputpricerange").val();       var bedrooms = $j("#inputbedrooms").val();       $j.ajax({           type:"get",           url:'/custom_action.php',            data:'action=filter_area'+'&operation='+operation+'&area_id='+area_id+'&subarea_id='+subarea_id+'&propertytype='+propertytype+'&pricerange='+pricerange+'&bedrooms='+bedrooms,       }).done(function(response){                    $j('#inputarea').html(response);           });  }   function filter_subarea()  {       var area_id = $j('#inputarea').val();       var operation = $j('#property').val();       var subarea_id = $j("#inputsubarea").val();       var propertytype = $j("#inputpropertytype").val();       var pricerange = $j("#inputpricerange").val();       var bedrooms = $j("#inputbedrooms").val();       $j.ajax({           type:"get",           url:'/custom_action.php',            data:'action=filter_area'+'&operation='+operation+'&area_id='+area_id+'&subarea_id='+subarea_id+'&propertytype='+propertytype+'&pricerange='+pricerange+'&bedrooms='+bedrooms,       }).done(function(response){                    $j('#inputsubarea').html(response);            });  }   function filter_propertytype()  {       var area_id = $j('#inputarea').val();       var operation = $j('#property').val();       var subarea_id = $j("#inputsubarea").val();       var propertytype = $j("#inputpropertytype").val();       var pricerange = $j("#inputpricerange").val();       var bedrooms = $j("#inputbedrooms").val();       $j.ajax({           type:"get",           url:'/custom_action.php',            data:'action=filter_area'+'&operation='+operation+'&area_id='+area_id+'&subarea_id='+subarea_id+'&propertytype='+propertytype+'&pricerange='+pricerange+'&bedrooms='+bedrooms,       }).done(function(response){                    $j('#inputpropertytype').html(response);           });  }   function filter_pricerange()  {       var area_id = $j('#inputarea').val();       var operation = $j('#property').val();       var subarea_id = $j("#inputsubarea").val();       var propertytype = $j("#inputpropertytype").val();       var pricerange = $j("#inputpricerange").val();       var bedrooms = $j("#inputbedrooms").val();       $j.ajax({           type:"get",           url:'/custom_action.php',            data:'action=filter_area'+'&operation='+operation+'&area_id='+area_id+'&subarea_id='+subarea_id+'&propertytype='+propertytype+'&pricerange='+pricerange+'&bedrooms='+bedrooms,       }).done(function(response){                    $j('#inputpricerange').html(response);             });  }  function filter_bedrooms()  {       var area_id = $j('#inputarea').val();       var operation = $j('#property').val();       var subarea_id = $j("#inputsubarea").val();       var propertytype = $j("#inputpropertytype").val();       var pricerange = $j("#inputpricerange").val();       var bedrooms = $j("#inputbedrooms").val();       $j.ajax({           type:"get",           url:'/custom_action.php',            data:'action=filter_area'+'&operation='+operation+'&area_id='+area_id+'&subarea_id='+subarea_id+'&propertytype='+propertytype+'&pricerange='+pricerange+'&bedrooms='+bedrooms,       }).done(function(response){                    $j('#inputbedrooms').html(response);           });  } 

please see images in image1 if execute ajax takes 4-5 sec complete requests. , in image2 have executed 1 ajax out of them finished within 1 sec.

image1

image2

and have not used session @ server side script. simple php script handle request , create response.

i have googled find how use multiple ajax simultaneously , found below link-

two simultaneous ajax requests won't run in parallel

since uses session in server side script, has used session_write_close(), have no used of session in server side script, still tried put function before sending response, nothing worked.

can 1 please tell me have execute ajax request concurrently.?

if thing not clear please ask.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

php - Find a regex to take part of Email -

javascript - Function overwritting -