jquery - Ajax call did not get any response & not able to drop product second time in cart -
i want add together products cart using drag & drop. in drop function phone call ajax function add together products cart:
the url
variable contains checkout cart url based on product.
jquery(function() { jquery(".category-products" ).accordion(); jquery(".product-name" ).draggable({ appendto: "body", helper: "clone" }); jquery(".block-content ol" ).droppable({ activeclass: "ui-state-default", hoverclass: "ui-state-hover", accept: ":not(.ui-sortable-helper)", drop: function( event, ui ) { jquery( ).find( ".placeholder" ).remove(); var url = ui.draggable.attr('id'); jquery.get(url, function(data) { // info response server.. if(data.status == 'error'){ alert(data.message); } console.log(data); }); url += 'isajax/1'; url = url.replace("checkout/cart","draggableproduct/index"); seek { jquery.ajax( { url : url, datatype : 'json', success : function(data) { if(jquery('.block-cart')){ jquery('.block-cart').replacewith(data.sidebar); } if(jquery('.header .links')){ jquery('.header .links').replacewith(data.toplink); } } }); } grab (e) { alert(e); } jquery( "<li></li>" ).text( ui.draggable.text() ).appendto( ); } }).sortable({ items: "li:not(.placeholder)", sort: function() { // gets added unintentionally droppable interacting sortable // using connectwithsortable fixes this, doesn't allow customize active/hoverclass options jquery( ).removeclass( "ui-state-default" ); } }); });
and on indexcontroller code contain:-
$this->loadlayout(); $toplink = $this->getlayout()->getblock('top.links')->tohtml(); $sidebar_block = $this->getlayout()->getblock('cart_sidebar'); mage::register('referrer_url', $this->_getrefererurl()); $sidebar = $sidebar_block->tohtml(); $response['toplink'] = $toplink; $response['sidebar'] = $sidebar; $this->getresponse()->setbody(mage::helper('core')->jsonencode($response)); homecoming ;
the product added cart ajax phone call not completed don't response , after dropping 1 product not able drop more products in cart. please help me
you can use
jquery.post(url,callback).
jquery ajax magento magento-1.7 jquery-ui-draggable
No comments:
Post a Comment