0

我嘗試實現來自服務器的動態標記列表。我注意到,當用戶點擊按鈕的速度很快(例如0.5秒/秒)時,標記會以巨大延遲(有時超過3秒)重新出現......?什麼會導致這種情況?這是我的代碼。非常感謝 ?Gmap3清除並添加標記太快導致延遲

  $("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); 
        } 

       }); 
      }); 
+0

任何幫助:((... ... – user2294520

+0

請幫助....沒有人使用gmap3 ?? – user2294520

+0

我卡在這裏>。< – user2294520

回答

0

我相信這與你的服務器端代碼在阿賈克斯有關。在Web檢查器中檢查資源的加載時間,例如firebug或chrome開發者工具。