Обновления в тегах
Доброго времени суток,
у меня есть скрипт по обновлению корзинки function addToCart(element, imageToFlyId, mode, text, cnt, maxCnt) { if (!element || !element.href) return false; cnt = parseInt(cnt); maxCnt = parseInt(maxCnt); if(cnt <= 0) return false; if(cnt > maxCnt && maxCnt != 0){ alert('Вы можете положить в корзину не более ' + maxCnt + '!'); return false; } var button = $(element); if (mode == "detail") button.toggleClass("disabled").unbind('click').css("cursor", "default"); else if (mode == "list") button.removeClass("catalog-item-buy").addClass("catalog-item-in-the-cart").unbind('click').css("cursor", "default"); /* ajax_buy вместо quantity*/ $.get( element.href + "&quantity=" + cnt, $.proxy( function(data) { if (this.mode == "detail") this.button.removeAttr("href").html("<span>" + text + "</span>"); else if (this.mode == "list") this.button.removeAttr("href").html(text); var imageElement = document.getElementById(this.imageToFlyId); if (!imageElement) { $("#bib").html(data); return; } var hoverClassName = ""; var wrapper = null; if (this.mode == "detail") { hoverClassName = "catalog-detail-hover"; wrapper = this.button.parents("div.catalog-detail"); } else if (this.mode == "list") { hoverClassName = "catalog-item-hover"; wrapper = this.button.parents("div.catalog-item"); } wrapper.unbind("mouseover").unbind("mouseout").removeClass(hoverClassName); var imageToFly = $(imageElement); var position = imageToFly.position(); var flyImage = imageToFly.clone().insertBefore(imageToFly); flyImage.css({ "position": "absolute", "right": position.right, "top": position.top }); flyImage.animate({ width: 0, height: 0, right: 10, top: -350 }, 600, 'linear'); flyImage.data("hoverClassName", hoverClassName); flyImage.queue($.proxy(function() { this.flyImage.remove(); $("#bib").html(data); if (this.wrapper.data("adminMode") === true) { var hoverClassName = ""; if (this.mode == "detail") hoverClassName = "catalog-detail-hover"; else if (this.mode == "list") hoverClassName = "catalog-item-hover"; this.wrapper.addClass(hoverClassName).bind({ mouseover: function() { $(this).removeClass(hoverClassName).addClass(hoverClassName); }, mouseout: function() { $(this).removeClass(hoverClassName); } }); } }, {"wrapper" : wrapper, "flyImage" : flyImage, "mode": this.mode})); }, { "button": button, "mode": mode, "imageToFlyId" : imageToFlyId } ) ); return false; } Скрипт работает, но запихивает всю страницу целиком, а мне нужно чтоб обновлялся только кусок страницы который в тегах bib |
Часовой пояс GMT +3, время: 19:55. |