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?

Reply via email to