На данный момент у меня реализовано ajax добавление товара в корзину
как можно показать товар(картинку) который был добавленн в отдельном блоке на сайте ?
| Код |
|---|
$(document).ready(
function(){
buy_btns = $('a[href*="ADD2BASKET"]');
buy_btns.each(
function(){
$(this).attr("rel", $(this).attr("href"));
}
);
buy_btns.attr("href","javascript:void(0);");
function getBasketHTML(html){
txt = html.split('<!--start--><div id="bid">');
txt = txt[2];
txt = txt.split('</div><!--end-->');
txt = txt[0];
return txt;
}
function getBasketHTML2(html){
txt2 = html.split('<!--start--><div id="bid2">');
txt2 = txt2[2];
txt2 = txt2.split('</div><!--end-->');
txt2 = txt2[0];
return txt2;
}
$('a[rel*="ADD2BASKET"]').click(function(){
$.ajax({
type: "GET",
url: $(this).attr("rel"),
dataType: "html",
success: function(out){
$("#bid").html(getBasketHTML(out));
$("#bid2").html(getBasketHTML2(out));
document.getElementById('parent_popup').style.display='block';
}
});
});
});
|