javascript - Gmap3 clear and add marker too fast causes delay -


i try implement dynamic marker list come server. notice when user click button quite fast (0.5 sec/s example), markers re-appear huge delay (sometimes on 3 secs)... ? causing that? here's code. ?

          $("a#userbookmark").click(function () {               $.ajax({                   type: "post",                   url: "details.aspx/loaduserbookmark",                   data: "",                   contenttype: "application/json",                   datatype: "json",                   success: function (res) {                       if (!res.d) {                           window.location = "login.aspx?url=" + "<%= clsstringextensions.base64encode("details.aspx")%>";                       }                       else {                           $("#mapdetail").gmap3({                               clear: {                                   name: "marker",                                   all: true                               },                               marker: {                                   values: res.d,                                   options: {                                       draggable: false                                   },                                   events: {                                       click: function (marker, event, context) {                                           var map = $(this).gmap3("get"),                                             infowindow = $(this).gmap3({ get: { name: "infowindow" } });                                           if (infowindow) {                                               infowindow.open(map, marker);                                               infowindow.setcontent(context.data);                                           } else {                                               $(this).gmap3({                                                   infowindow: {                                                       anchor: marker,                                                       options: {                                                           content: context.data,                                                           maxwidth: 400                                                       }                                                   }                                               });                                           }                                       }                                       //                         mouseout: function () {                                       //                             var infowindow = $(this).gmap3({ get: { name: "infowindow" } });                                       //                             if (infowindow) {                                       //                                 infowindow.close();                                       //                             }                                       //                         }                                   }                               }                           });                       }                    },                   error: function (errorobjstring) {                       var err = $.parsejson(errorobjstring.responsetext);                       alert(err.message);                   }                });           }); 

i believe has server side code in ajax. checking load time of resources in web inspector firebug or chrome developer tools.


Comments