http://tinyurl.com/cyecuf http://tinyurl.com/ahvxzc
http://tinyurl.com/8rwmkr http://tinyurl.com/7wbm8o On 2/27/09, heohni <heidi.anselstet...@consultingteam.de> wrote: > > > I see.. > > But is this normal? > I do not have any database queries in these ajax files. > Only session handling. > > For example to add the prouct and to check the array size: > > if(!$_POST['ver_id'] && isset($_POST['postdata'])){ > $verids = explode(",",$_POST['postdata']); > foreach($verids as $ver_id){ > > if(is_numeric($ver_id))$_SESSION['checked_products'][$ver_id] = > $ver_id; > } > }else{ > if(is_numeric($_POST['ver_id']))$_SESSION['checked_products'][$_POST > ['ver_id']] = $_POST['ver_id']; > } > > // delete double id's > if(is_array($_SESSION['checked_products']))$_SESSION > ['checked_products'] = array_unique($_SESSION['checked_products']); > > > if (is_array($_SESSION['checked_products']) && count($_SESSION > ['checked_products']) > 0){ > echo count($_SESSION['checked_products']); > }else{ > echo 0; > } > > and to delete products from the session: > if(!$_POST['ver_id'] && $_POST['postdata']){ > $verids = explode(",",$_POST['postdata']); > foreach($verids as $ver_id){ > if(is_numeric($ver_id))unset($_SESSION['checked_products'] > [$ver_id]); > } > }else{ > if(is_numeric($_POST['ver_id']))unset($_SESSION['checked_products'] > [$_POST['ver_id']]); > } > > if(count($_SESSION['checked_products']) == 0) unset($_SESSION > ['checked_products']); > > > So really nothing special,or? > What can I do to speed it up? Any ideas? > > Thanks! > > On 26 Feb., 19:17, James <james.gp....@gmail.com> wrote: > > I don't think it's the append that's taking long. It seems more like > > the AJAX request and response (which might differ depending on your > > location, of course) that's holding things up. > > Here's what's happening for me. Everytime I click on a checkbox, an > > AJAX call is made to: > > ajax_unselected_products_from_session.php?singleevent > > this request took about 450ms to 650ms for me. > > immediately afterward, another AJAX call is made to: > > ajax_add_selected_product_to_session.php?global_check > > which takes an average of about 450ms for me. Then upon response of > > that, your append is executed. > > > > This means that upon clicking your checkbox, it does 2 AJAX calls that > > takes approximately a second to complete, then it updates your text. > > > > On Feb 26, 4:15 am,heohni<heidi.anselstet...@consultingteam.de> > > wrote: > > > > > Hi, > > > > > I have this function build: > > > > > $.ajax({ > > > type: "POST", > > > url: > "/ajax_add_selected_product_to_session.php?global_check", > > > success: function(msg){ > > > /* add here what to do on success */ > > > //alert(msg); > > > howmanyfromsession = msg; > > > > > if (howmanyfromsession == 1){ > > > $(".amount").empty(); > > > $(".amount").append(' (Derzeit > ist ' + howmanyfromsession + ' > > > Produkt vorgemerkt)'); > > > }else if(howmanyfromsession > 1){ > > > $(".amount").empty(); > > > $(".amount").append(' (Derzeit > sind ' + howmanyfromsession + ' > > > Produkte vorgemerkt)'); > > > }else if(howmanyfromsession == 0){ > > > $(".amount").empty(); > > > } > > > > > if(howmanyonpage == 0 && > howmanyfromsession == 0) { > > > //alert('None are checked on page'); > > > > $(".requestbutton").attr("disabled", "disabled"); > > > }else if(howmanyonpage == 0 && > howmanyfromsession > 0){ > > > //alert('At least one is > checked'); > > > > $(".requestbutton").removeAttr("disabled"); > > > > $(".requestbutton").click(function(){ > > > $("#list").submit(); > > > }); > > > } > > > > > $(".requestbutton").click(function(){ > > > > if($("input[name^='paradigm']:checked").length > 0) { > > > $("#list").submit(); > > > } > > > }); > > > } > > > > > The part with: > > > $(".amount").append(' (Derzeit ist ' + howmanyfromsession + ' Produkt > > > vorgemerkt)'); > > > takes really long at the moment. Is there a way to improve the speed? > > > If you want you can test it here: > http://packpilot.s15312582.onlinehome-server.info/search.php?action=l... > > > Look for the button "Für ausgewählte Artikel Herstelleranfrage senden" > > > on its right hand side a small text will appear, telling how many > > > products you have selected. > > > I don't understand why it takles so long...? > > > > > Any ideas?